Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DLookup error

Status
Not open for further replies.

stalo

Programmer
May 1, 2001
35
CY
I have the following function that gets time as a parameter in the form of 8:00:00am. I format it to "h:mm" but still continues to be 8:00:00am. The field is formatted as Short Date. I also have a Query where I group together all appointments scdheduled for the same time. I created a DLookup to get the value of how many persons have an apointment in the same time but the system returns the error "Run Time Error 3075". I believe it has something to do with the time value itself but I cannot locate the problem. In the table the time is saved as a short date 08:00 not 08:00:00 am.

Here is the code, any help will be appreciated.

Function FindTime(ATime As Date)
Dim TTime As Date
Dim NTime As Date

TTime = Format(ATime, "h:mm")

NTime = DLookup("Persons", "QSchedule", "ATime =#" & TTime & "#")

And here is where I call the function:

Private Sub Command22_Click()
Dim TTime As Date
TTime = Format("8:00", "h:mm")
FindTime (TTime)
End Sub

 
Try :
NTime = DLookup("Persons", "QSchedule", "ATime =#" & Format(ATime, "h:mm") & "#")

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top