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!

Requring data entry notifications. 1

Status
Not open for further replies.

alblunkproex

IS-IT--Management
Jun 25, 2008
18
US
If I just want to require entry into these to areas I should do this right? Or am I missing something?


If Me.[Justification] = "" Then
MsgBox "You must Justify this Request."
Cancel = True
ElseIf Me.[Order Summary] = "" Then
MsgBox "You must enter an Order Summary."
Cancel = True
ElseIf Me.[Order Summary] <> "" And Me.[Justification] <>""
Then
DoCmd.Save
DoCmd.Close
End If


Also is there a way to close the form and save automatically using vba?
 
To close and save:

DoCmd.Close acForm,"frmNameHere",acSaveYes
 
Thanks Remou


The problem with the validation code is that It will correctly check the first one, then after data entry of the first one... you click on it again and it wont show the msg box for the other one if it is blank... but it wont close.. so i know its working...if i do fill it in, it will close.
 
How about:

Code:
If Trim(Me.[Justification] & "") = "" Or Trim(Me.[Order Summary] & "")="" Then
   If Trim(Me.[Justification] & "") = "" 
      MsgBox "You must Justify this Request."
      Cancel = True
   Else
      MsgBox "You must enter an Order Summary."
      Cancel = True
   End If
Else
    DoCmd.Save
    DoCmd.Close
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top