Convert reference to form control to time format

  • Thread starter Thread starter mike
  • Start date Start date
M

mike

Hi there. I have reference to a form control that is part
of recordset filter in a module. The rs filter looks like
this:

Public Sub SendDailyNumbers()
Set Db = CurrentDb
Set rs = Db.OpenRecordset("SELECT * " & _
"FROM [tblMain]" & _
"WHERE [SENDTIME]=Forms!Dashboard!Clock")
etc...

This looks up people in my table, tblMain, and sends a
message to them if their [SENDTIME] is the same as the
clock on the form which is called Dashboard. It all works
fine except for the part of the code in the module that
reads [SENDTIME]=Forms!Dashboard!Clock. If I replace Forms!
Dashboard!Clock with #6:00:00 AM#, for example, it works
fine, so I guess I need to figure out how to convert the
refrence to Forms!Dashboard!Clock to time format. Any
suggestions would be great. Thanks!
 
Thanks for the suggestion. I can't use the double quotes
before the & or the expression will think it has ended, so
I tried a single quoate and it didn't work:

[SMSTIME]= ' & Forms!Dashboard!Clock

and I tried

[SMSTIME]= & Forms!Dashboard!Clock

No luck. Any other suggestions would be great. Thanks!
-----Original Message-----
Try "WHERE [SENDTIME]=" & Forms!Dashboard!Clock
-----Original Message-----
Hi there. I have reference to a form control that is part
of recordset filter in a module. The rs filter looks like
this:

Public Sub SendDailyNumbers()
Set Db = CurrentDb
Set rs = Db.OpenRecordset("SELECT * " & _
"FROM [tblMain]" & _
"WHERE [SENDTIME]=Forms!Dashboard!Clock")
etc...

This looks up people in my table, tblMain, and sends a
message to them if their [SENDTIME] is the same as the
clock on the form which is called Dashboard. It all works
fine except for the part of the code in the module that
reads [SENDTIME]=Forms!Dashboard!Clock. If I replace Forms!
Dashboard!Clock with #6:00:00 AM#, for example, it works
fine, so I guess I need to figure out how to convert the
refrence to Forms!Dashboard!Clock to time format. Any
suggestions would be great. Thanks!
.
.
 
Back
Top