Autofilter in a form using query

M

Mike D.

I'm having a brain fart for something that seems simple -

I have a form that references a query for info. I want
the form to automatically update with the record
information when the DATE field is entered (for either
new entry or editting).
In my query, I have the DATE criteria as - [Forms]![Form]!
[Date]

It's just not working and I can't think of how to get it
to work. Do I need to somehow "autoupdate" the form??
Thank you for your help.
 
R

Rob Whythe

Mike,

Sounds like you are using the 'Date' on the form to select a given record?
If so, beware: The 'date' is not a good key to use for this, since it
normally contains 'time' as well, as a decimal part. If you attempt to match
the date in a query like this, it will see one minute past midnight on a
given day as different from 2 past midnight on the same day. You may need to
convert 'Date' to an integer count of days first [i.e. days = CLng(date)] in
the query for both the field and for the criteria to make sure it works.

Anyway, once that's done:

Make sure the 'Date' box on the form is not bound to the 'Date' field in the
form Record Source.
Program 'Me.Requery' In the Date_AfterUpdate event procedure.

When you enter a date in the unbound Date box and move to the next box, the
AfterUpdate procedure will requery the form which will select the first
record with the given date. Any 'bound boxes on the form should then
automatically update with the data from that record.

Rob
 
Top