|
-
Aug 13th, 2001, 04:45 PM
#1
Thread Starter
New Member
what's wrong with this function?
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("PostingDate"))
RS.Close
Set RS = Nothing
End Function
-
Aug 13th, 2001, 04:50 PM
#2
Frenzied Member
Do you have the Conn object declared in the General declarations?
-
Aug 14th, 2001, 12:42 AM
#3
Re: what's wrong with this function?
Originally posted by Angelle
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("PostingDate"))
RS.Close
Set RS = Nothing
End Function
Also, can you assign 0 to a date variable?
.
-
Aug 14th, 2001, 12:59 AM
#4
Frenzied Member
Conn.Execute should be
Conn.OpenRecordset
-
Aug 14th, 2001, 04:11 AM
#5
Frenzied Member
or is it:
Code:
dim strSQL as string
strSQL = "SELECT * " _
& "FROM AR " _
& "WHERE AccountNumber = '" & AccountNumber & "' " _
& "ORDER BY PostingDate DESC"
rs.Open strSQL, conn, adOpenKeyset, adLockOptimistic
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|