fat controller
Slightly round the bend..
- Local time
- Today, 13:08
- Joined
- Apr 14, 2011
- Messages
- 758
I have a DLookup that won't work, and I have no idea why;
Field name - ID (Primary key, autonumber)
Table name - tblQSI
Criteria - find the ID of the record that has a service date matching the date in unbound text box.
Now, I know that there is a record matching the date I put in, one because I have checked the table and there is only three test records in there at the moment, and two because it has been checked using DCount on a prior step on the form (it determines which of the controls become visible, and this code is for one of the controls that becomes visible), and the DCount line is pretty similar to the above
The DCount works fine, but the DLookup is returning null?
Field name - ID (Primary key, autonumber)
Table name - tblQSI
Criteria - find the ID of the record that has a service date matching the date in unbound text box.
Code:
Dim DateChk
Dim varID
DateChk = Me.txtDateCheck.Value
varID = DLookup("ID", "tblQSI", "Service_Date=#" & DateChk & "#")
Code:
If DCount("Service_Date", "tblQSI", "Service_Date=#" & DateChk & "#") = 0 Then