1. What is the difference between these two assignment operations (VB/VBA)?
Set object2 = object1
object2 = object1
2. What is the difference between these two statements (VB/VBA)?
If object1 Is object2 Then (...)
If object1 = object2 Then (...)
3. Can function results be objects?
4. What are some of the things that are wrong with this function (VB/VBA)? There is a bug in this code which will show up in certain cases. What is it?
Public Function LastPaymentDate( Conn As ADODB.Connection, _
AccountNumber As String) As Date
Dim RS As ADODB.Recordset
Set RS = Conn.Execute( _
"SELECT * " _
& "FROM AR " _
& "WHERE AccountNumber = '" & AccountNumber & "' " _
& "ORDER BY PostingDate DESC")
LastPaymentDate = IIf(RS.EOF, 0, RS.Fields("PostingDate").Value)
Set RS = Nothing
5. How can I get the last day of a certain month in VB/VBA? Please complete the following function:
Public Function LastDayOfMonth(Mn As Integer, Yr As Integer) As Date