rs.FindFirst help, re dates & time values.

  • Thread starter lee_cufc via AccessMonster.com
  • Start date
L

lee_cufc via AccessMonster.com

Hi,

I am stuck with the following part of my system code:


Set rs = Me.Recordset.Clone
[Time Of Appointment] = Dates.TimeOfBooking
[Date Of Appointment] = Dates.DateOfBooking
rs.FindFirst Format([Time Of Appointment], "hh:mm") & Format([Date Of
Appointment], "mm\/dd\/yyyy") & "#"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

If rs.NoMatch = True Then
DoCmd.GoToRecord , , acNewRec



Basically, 'Dates.TimeOfBooking' and 'Dates.DateOfBooking' are global
variables which hold the 2 values i need. when this form is opened i want it
to search for the record which has a match on the 'Date Of Appointment' and
'Time Of Appointment' fields with those values held in the global variables
as mentioned above.

So far this code adds new record correctly however returns a sytax error
which reads 'missing operator in expression' i am pretty uncertain on how to
set the format for searching for date and time values so i guess this is
where i am going wrong?

many thanks in advance, any help is most welcome.
Lee
 
S

Stefan Hoffmann

hi,

lee_cufc via AccessMonster.com said:
Set rs = Me.Recordset.Clone
[Time Of Appointment] = Dates.TimeOfBooking
[Date Of Appointment] = Dates.DateOfBooking
rs.FindFirst Format([Time Of Appointment], "hh:mm") & Format([Date Of
Appointment], "mm\/dd\/yyyy") & "#"
Change this to

Dim Condition As String

Condition = Format([Time Of Appointment], "hh:mm") & _
Format([Date Of Appointment], "mm\/dd\/yyyy") & "#"
MsgBox Condition
So far this code adds new record correctly however returns a sytax error
which reads 'missing operator in expression' i am pretty uncertain on how to
set the format for searching for date and time values so i guess this is
where i am going wrong?
Condition must be something like "[yourField] = #04-23-2009 18:55#"...


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top