Code question

Peter Paul

Registered User.
Local time
Today, 20:51
Joined
Jan 1, 2000
Messages
82
Greetings,
I am working on a form which needs to prompt the user to enter data based on specific information. Part of the data looks to see

If Me.Code = "220" And Me.LocationOfOffense = "14" Or Me.LocationOfOffense = "19" And IsNull(Me.PremisesEntered) Then
Cancel = True
MsgBox "message here"
Else
DoCmd.GoToRecord , , acNewRec
Me.OffenseNumber.SetFocus

This gets the user to the field PremisesEntered.

Now I want to insist that they user enter data in this box. So in the On Exit property I want to look to see if the field is empty. If it is, then they should either have to enter data, or return to the Code field to change the data that got them to that point. What I have tried is not working:
If Me.Code = "220" And Me.LocationOfOffense = "14" Or Me.LocationOfOffense = "19" And IsNull(Me.PremisesEntered) Then
MsgBox "Click OK to enter the number of premises entered, or change the Offense Code or Cancel to change the data input", vbOKCancel, "CRIMES Information - Breaking and Entering"
If Cancel Then Me.Code.SetFocus
If OK Then
Me.PremisesEntered.SetFocus
End If
End If

Any help, as always, is greatly appreciated.

Peter Paul
 

Users who are viewing this thread

Back
Top Bottom