Validation rule question

G

Guest

I have a form that is used to release specific items from hold. I have a
table for holds and a table for releases. The release form is used to look up
holds and to release them. I have a validation rule in place to make sure
that the release date is after the hold date but also on or before today's
date. This works fine, except that I am using a popup calendar to input the
date into the text box on my form. When I use the calendar function, it does
not validate my date. I am using one I found on the internet written by Allen
Browne (http://www.everythingaccess.com/tutorials.asp?ID=Popup-Calendar). Is
there any code I can add to check the validate the date after using the popup
calendar?

Thank you very much for any help.
 
A

Allen Browne

Set the On Click property of your command button to:
[Event Procedure]

Click the Build button beside the property.
Access opens the code window.

Add code that changes the value back if it doesn't meet your requirements.

Example:

Call CalendarFor(Me.SaleDate, "Select the sale date")
If Me.SaleDate > Date Then
MsgBox "Cannot be sold in the future"
Me.SaleDate = Me.SaleDate.OldValue
End If
 
G

Guest

Hey, thanks a lot. That works great. One more thing. Is there any way to
check if it is before the initial hold date? This value is stored in a Holds
table and is linked to the release table through the HoldID. I would like the
form to make sure that the user does not enter a release date that was before
the hold date. I will continue to try to solve this, but if you know a quick
fix, that would be great.

Again, thank you so much for the help.


Allen Browne said:
Set the On Click property of your command button to:
[Event Procedure]

Click the Build button beside the property.
Access opens the code window.

Add code that changes the value back if it doesn't meet your requirements.

Example:

Call CalendarFor(Me.SaleDate, "Select the sale date")
If Me.SaleDate > Date Then
MsgBox "Cannot be sold in the future"
Me.SaleDate = Me.SaleDate.OldValue
End If

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Iowa Joe said:
I have a form that is used to release specific items from hold. I have a
table for holds and a table for releases. The release form is used to look
up
holds and to release them. I have a validation rule in place to make sure
that the release date is after the hold date but also on or before today's
date. This works fine, except that I am using a popup calendar to input
the
date into the text box on my form. When I use the calendar function, it
does
not validate my date. I am using one I found on the internet written by
Allen
Browne (http://www.everythingaccess.com/tutorials.asp?ID=Popup-Calendar).
Is
there any code I can add to check the validate the date after using the
popup
calendar?

Thank you very much for any help.
 
G

Guest

Nevermind Allen, I figured it out (mainly due to your help). It brings me
back to some of my old C programming days (laughs). Thanks a lot for the help
and the awesome popup calendar.

Iowa Joe said:
Hey, thanks a lot. That works great. One more thing. Is there any way to
check if it is before the initial hold date? This value is stored in a Holds
table and is linked to the release table through the HoldID. I would like the
form to make sure that the user does not enter a release date that was before
the hold date. I will continue to try to solve this, but if you know a quick
fix, that would be great.

Again, thank you so much for the help.


Allen Browne said:
Set the On Click property of your command button to:
[Event Procedure]

Click the Build button beside the property.
Access opens the code window.

Add code that changes the value back if it doesn't meet your requirements.

Example:

Call CalendarFor(Me.SaleDate, "Select the sale date")
If Me.SaleDate > Date Then
MsgBox "Cannot be sold in the future"
Me.SaleDate = Me.SaleDate.OldValue
End If

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Iowa Joe said:
I have a form that is used to release specific items from hold. I have a
table for holds and a table for releases. The release form is used to look
up
holds and to release them. I have a validation rule in place to make sure
that the release date is after the hold date but also on or before today's
date. This works fine, except that I am using a popup calendar to input
the
date into the text box on my form. When I use the calendar function, it
does
not validate my date. I am using one I found on the internet written by
Allen
Browne (http://www.everythingaccess.com/tutorials.asp?ID=Popup-Calendar).
Is
there any code I can add to check the validate the date after using the
popup
calendar?

Thank you very much for any help.
 

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