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

Date field if not null, Value must be entered 1

Status
Not open for further replies.

Mr2006

Technical User
Jun 21, 2006
80
US
I have Purchase date field in the database that is not mandatory field. But I want if someone write a date in this field, the combobox under it for Yes and no to be mandatory.

Any suggestions
 
How are ya Mr2006 . . .

Interpretation is a little open here. I'm assuming you mean a date entered in [blue]Purchase Date[/blue] means the Yes/No field should be set to [blue]Yes[/blue]. This makes the code in the [blue]AfterUpdate[/blue] event of [blue]PurchaseDate[/blue] look like:
Code:
[blue]   Me![[purple][B][I]YesNoName[/I][/B][/purple]] = (Trim(Me![[purple][B][I]PurchaseDate[/I][/B][/purple]] & "") <> "")[/blue]
[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
I am fine. How are you TheAceMan1? Hope all is well with you. I am happy to hear from you.

There are two fields.
1) Purchase date: can be blank. But if staff enter purchased date, they must choose an option from the combobox below it. Shipping Needed: Yes or No.

Thanks
 
Mr2006 . . .

In the forms [blue]BeforeUpdate[/blue] event, copy/paste the following:
Code:
[blue]   If Not IsNull(Me![Purchase Date]) And IsNull(Me![Shipping Needed]) Then
      MsgBox "You must make a selection in Shipping Needed!"
      Me![Shipping Needed].SetFocus
      Cancel = True
   End If[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Yes. this worked perfectly. But I want to give the user to input the data. rightnow, it gives the message box but witout an option to go and enter information
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top