This should be easy but I've tried several versions of a For Each statement and have had no success. The following code works, but I'd rather loop through the controls without naming them and have the code do the same thing. Basically, if any of the controls are null, the On Click to pull up the next form is not carried out. However, if all controls have values, close the existing form and pull up the next.
Any assistance would be appreciated.
-David
Code:
Private Sub cmdGoToLoggerForm_Click()
If IsNull(Me.cboCountyName) Then
MsgBox "You must enter information into all fields before continuing."
ElseIf IsNull(Me.cboPopulatedPlaces) Then
MsgBox "You must enter information into all fields before continuing."
ElseIf IsNull(Me.cboRoadName) Then
MsgBox "You must enter information into all fields before continuing."
ElseIf IsNull(Me.cboRiverBasin) Then
MsgBox "You must enter information into all fields before continuing."
ElseIf IsNull(Me.intEstimatedAcres) Then
MsgBox "You must enter information into all fields before continuing."
Else
'Close existing form and open Logger Main Form
DoCmd.Close
DoCmd.OpenForm "frmGeneralSiteInfoLogger"
End If
End Sub
Any assistance would be appreciated.
-David