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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mandatory Entry in a field when another entered

Status
Not open for further replies.

SuePee

Technical User
Jun 10, 2003
47
US
Here's the deal.
I have a form that has a deliverable date. Then there is a deliverable modified date. What I want to do is, when one fills in the modified date the Modification explanation form pops up. I use a calendar form for the date and I have a command button for the Modification Explanation form. I want to make it so the date cannot be saved unless an explanation is entered.

One thing I thought was, I could put the date on the subform (Modification Explanation), but then how would I get it to auto-entry on the main form?

I get so confused! [cry]
 
SuePee:

What you thought was right - just need to mix in a couple of other ingredients ... or one, and that's a little bit 'o VBA code! :)

1) Place the following line of code in a new Module:
Code:
    Public bAllOk As Boolean
[code]
    * save this module with whatever name you wish.

2)  In the Form_Load event of your deliverable date form, enter the following line of code:
[code]
    bAllOk = False
3) In your modification explantion form:
- If the user has entered a reason for the modification, set the value of bAllOk to True; vice-versa if the user did not enter a reason.

4) Back to the deliverable date form: When the user attempts to save the data, check the value that is stored in the bAllOk variable. If bAllOk = True, then you know that the user entered a reason, and you can save the date. But if bAllOk = False, the user did not enter a reason. You can display a message or something to the user, and Exit out of the Save subroutine - you don't want to save if the user did not enter a reason ... right? :)

If you need any other assistance, please leave a post - I've marked the thread.

HTH


Greg Tammi, IT Design & Consultation
Work: Home:
 
Hi grtammi,

Thanks for the quick response. However, when it comes to code and macros and all that stuff, I am extremely limited. I placed the code in a macro I called DateMod. Then I placed the code bAllok = False in the On Open event. Just like steps 1 & 2. Then we got to step 3. I didn't quite understand, well I understood what you were saying, just not how to execute it.

Please explain as if you were writing a "for dummies" book.

Thanks
[reindeer2]
Sue
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top