gotorecord problem

pascal

isolation
Local time
Today, 06:16
Joined
Feb 21, 2002
Messages
62
I have a form, based on a table with unique dates, with a subform. When I open the form I like to see the record for today in the form if there is already one. If not I like to see a new record. How can I make this happen. I use Access 2000. Thanks in advance.
 
Add selection criteria to the query used as the form's recordsource:

Where YourTransactionDate >= Date();
 
Set this up in the On Load event

Dim rst as DAO.Recordset

Set rst=Me.Recordsetclone

rst.findfirst "[Date Field]=#" & date & "#"

if rst.nomatch then

docmd.gotorecord Record:=AcNewRecord

Else

me.bookmark=rst.bookmark

End if

Set rst=nothing
 
Thanks for your reply Pat. But when I make use of a query I filter the records and I won't see the other records anymore in my form. I still want to be able to scroll the other records to in my form.
 
Oops, I just missed Rob's reply while writing my reply to Pat. I think this could be it. I'm going to try this code first. Thanks Rob.
 
OK Rob, I've tried it and it works. Thanks again.
 

Users who are viewing this thread

Back
Top Bottom