I have a class, Customer
When I call the following function I have strange behavior:
If a record is found in the database it works fine, if no record is found it's like the function doesn't even run.
For testing I tossed a msgbox in after I declare my variables, if I give an accountID I know doesn't exist it won't even pop up the message box. If I give a valid accountID I get my test message box and my customer exists message box - all works fine.
When I call the following function I have strange behavior:
Code:
Public Function isCustomer(custID As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sqlstr As String
isCustomer = False
sqlstr = "SELECT * from tbltmpCustomer WHERE iAccountID = " & custID & ";"
Debug.Print sqlstr
Set db = CurrentDb
Set rs = db.OpenRecordset(sqlstr)
With rs
If .EOF = False Then
MsgBox "Customer exists"
isCustomer = True
Else
MsgBox "Customer does not exist"
End If
End With
rs.Close
db.Close
End Function
If a record is found in the database it works fine, if no record is found it's like the function doesn't even run.
For testing I tossed a msgbox in after I declare my variables, if I give an accountID I know doesn't exist it won't even pop up the message box. If I give a valid accountID I get my test message box and my customer exists message box - all works fine.