Validate date in form based on data on a table (1 Viewer)

Andyto

New member
Local time
Today, 03:26
Joined
Dec 4, 2023
Messages
4
I have this form to capture a date
1701721524693.png


I would like to validate the date entered in the form based on this table DateMaster, and before running a report that would came out as blank if there is no sales made on that entered date, thus having a validation that would advised "There are no Sales on that date" Thetable for a year is too long for a dropdown list

The table looks like this and it is linked to another with the salesmen, cities, etc linked by the order no which is unique.

OrderNoHOOKSENTDATEORDERDATEOrdertypeYearWeek
5351/7/1943BSRG1/16/20231/7/2023BSRG1
5361/7/1943BSSO1/16/20231/7/2023BSSO1
5371/14/1943BSRG1/23/20231/12/2023BSRG2
5381/14/1943BSSO1/27/20231/14/2023BSSO2
5401/21/1943BSRG1/30/20231/18/2023BSRG3
5411/21/1943BSSO1/30/20231/21/2023BSSO3
5421/28/1943BSRG2/4/20231/28/2023BSRG4
5431/28/1943BSSO2/6/20231/28/2023BSSO4
5452/4/1943BSRG2/13/20232/3/2023BSRG5
5462/4/1943BSSO2/13/20232/4/2023BSSO5
5482/11/1943BSRG2/20/20232/11/2023BSRG6
5492/11/1943BSSO2/21/20232/11/2023BSSO6
5512/18/1943BSSO2/287/20232/18/2023BSSO7
5532/25/1943BSRG3/6/20232/25/2023BSRG8
5542/25/1943BSSO3/6/20232/26/2023BSSO8

Please help with the validation linking the date enterer in the EnterDate Form to DateMaster.Orderdate or DateMaster.SentDate but I have been getting several access error trying to use an expression builder was noit useful either.
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 00:26
Joined
Oct 29, 2018
Messages
21,473
Hi. Welcome to AWF!

Did you mean to post a screenshot of your form instead of your macro?
 

Andyto

New member
Local time
Today, 03:26
Joined
Dec 4, 2023
Messages
4
The macro captures the data in the form. This is the form

1701727661563.png
 

Gasman

Enthusiastic Amateur
Local time
Today, 08:26
Joined
Sep 21, 2011
Messages
14,299
Captures it where?
The form is unbound.
Use a DCount() or DLookUp() to see if any records match the date entered. Then work from that.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 03:26
Joined
Feb 19, 2002
Messages
43,275
Wouldn't it be simpler to just add a message to the report's On No Data event?
 

Andyto

New member
Local time
Today, 03:26
Joined
Dec 4, 2023
Messages
4
Wouldn't it be simpler to just add a message to the report's On No Data event?
I had not thought about it and I have never used that option before. I gave it a try and it works. Thank you
 
Last edited:

Andyto

New member
Local time
Today, 03:26
Joined
Dec 4, 2023
Messages
4
Captures it where?
The form is unbound.
Use a DCount() or DLookUp() to see if any records match the date entered. Then work from that.
Thank you. I will try that!
 

Users who are viewing this thread

Top Bottom