Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Require Input on Form

Status
Not open for further replies.

swaggel1

Technical User
Jun 19, 2001
34
US
I have a very simple form, consisting only of an ID field, a title associated with the ID, three date fields, a comment field, and a search button so that the user can bring up data associated with the ID number.

What I need to accomplish is to require that an entry be made in the comment field if the information in any of the three date fields is changed; otherwise, the date change(s) won't be accepted. I know you can use the Validation Rule to have a message box pop up stating that the information is required, but is there any way to keep the date information from updating if the comment field isn’t completed?

I know one possibility would be to set the Validation Rule for the Comment field to "Is Not Null". However, in many instances, the Comment box will already include text; that text will need to be changed.

I have tried to figure out a way to use the BeforeUpdate event and have a comparison between the text in the field on the form and the text for the record in the table. If any of the date fields are updated, the text should no longer match, as the Comment field is supposed to be updated.

I tried adding a Save Record button to the form which would only be enabled if the Comment box were updated.

I have tried many things but, beyond getting the Message Box to work, I can't seem to pull everything I need together, and at this point, I don't know what the best option would be.

I have been trying to figure this out for 7 hours now - can anyone please help?????
 
Create a global variable. In the after update property of each date field set the value of the global variable.
for example var = 1
Or you could create a field on your form and set its invisible property to Yes so the user can't see it in run mode. Then, in the after update proc set the value of the field.
for example me!nameofinvisiblefield = 1
finally, in the proc that saves or closes the form add a line of code that says (if you use a global variable)
If var = 1 and IsNull(NameofCommentFieldonForm) Then
msgbox("You must enter a comment.")
End If

or if you use an invisible field

If me.nameofinvisiblefield = 1 and IsNull(NameofCommentFieldonForm) Then
msgbox("You must enter a comment.")
End If

Hope this helps you.

 
Try these threads. I did something similar in the following:

thread702-553535
thread702-558223
thread702-351560

I hope this helps.

Jerome Benton
JERPAT Web Designs
GOD Is Good All The Time!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top