Opening a form to Schedule Date that equals today or closest date

S

ScubaMD

I have a form for scheduling appointments which I am able to open via a
command button I made in a custom switchboard I made. The form opens to the
first record which has a schedule date from 2003. I want the form to open to
the record closest to today's date. I don't want to use a query because I
don't want the appointments before today to be excluded, I want the button to
open the form and go to the record where the Schedule Date is today or next
closest date. Any ideas? Let me know if I need to clarify what I'm looking
for.
Thanks
 
P

PC Datasheet

Create a query that includes your appointment records. Set the sort for
Schedule Date to ascending. Put this code in the Click event of your command
button:
Dim Db As DAO.Database
Dim Rst As DAO.Recordset
Set Db = CurrentDb()
Set Rst = Db.OpenRecordset("YourQueryName",dbOpenDynaset)
With Rst
.FindFirst "[Schedule Date] >= Date()"
Me.BookMark = .BookMark
.Close
End With
Set Rst = Nothing

I have an appointments module that displays all the time slots for any day
you want to enter appointments. The time slots are in 15 minute intervals or
they can be changed to the increment you want. You can enter names into any
time slot to record an appointment. If you are interested in seeing what I
have, I can email you a screen shot if you contact me at my email address
below.
 

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