Can someone give me an explanation please

daveUK

Registered User.
Local time
Today, 14:04
Joined
Jan 2, 2002
Messages
234
Hi Guys

I was hoping someone could give me an explanation of why:

1 - If you use a short date input mask in a textbox and you want to trap Access errors (2113, 2279) you have to use the code on the Form_Error event and not the textbox Before/After_Update event.

2 - If you use a query to find all records between certain dates and have the criteria as 'Between [Forms]![FrmName]![TxtBoxName] And [Forms]![FrmName]![TxtBoxName]' you need to add '+1' to the criteria to include the end date.

Thanks
Dave
 
Dave,

1 - No idea ...

2 - I think that Access uses dd/mm/yy 00:00 AM as the format
for each date part. If its the first date, then anything on
that day will be between. if its the second date, then nothing
on that day will be between, so you must add one day.

Wayne
 
Try defining the query parameters as date/time
 
Thanks for the info WayneRyan, that would explain it.
 
daveUK said:
1 - If you use a short date input mask in a textbox and you want to trap Access errors (2113, 2279) you have to use the code on the Form_Error event and not the textbox Before/After_Update event.


I'm not being facetious (honest), but if a run-time error occurs, the Form_Error event is triggered regardless of anything else. Both these errors are generated at run-time, (they are not syntax errors and the code will compile satisfactorily.) The message won't be generated by an Update event because the field isn't updated due to invalid data.
 
Thanks Ancient One, I hadn't thought of that :o :o
 
Ooops !!!

The previous databases I had worked on had the data defined as short date and the Between... and.. worked as stated in help, the current database has and audit trail with date and time and yes my testing hadn't picked up the point made in this thread, I guess i was lucky to be trawling the site before starting work today, have now corrected some 20 queries.

Thanks guys:)

Brian
 

Users who are viewing this thread

Back
Top Bottom