Coding question (1 Viewer)

Peter Paul

Registered User.
Local time
Today, 06:45
Joined
Jan 1, 2000
Messages
82
Greetings,
I am attempting to get a statement to work, and need some assistance. From the last field in a subform, I need to evaluate if the OffenseCode = "220", and if the LocationOfOffense = either "14" or "19" If these two conditions are met, then the focus needs to go to PremisesEntered. If not, then the focus needs to go from this subform, to another subform.

This is what I have been playing around with, but cannot get it to all work.

If Me.Code = "220" Then
If Me.LocationOfOffense = "14" Or "19" Then
Me.PremisesEntered.SetFocus
Cancel = True
Else: Forms!IncidentReport!CriminalActivitysubform.SetFocus

End If
End If

Any help would be greatly appreciated.

Peter Paul

[This message has been edited by Peter Paul (edited 03-29-2001).]

[This message has been edited by Peter Paul (edited 03-29-2001).]
 

llkhoutx

Registered User.
Local time
Today, 00:45
Joined
Feb 26, 2001
Messages
4,018
Try

If Me!Code = "220" and (Me!LocationOfOffense In ("14", "19")) Then

I think that you should use "me!" instead of "me."
 
R

Rich

Guest
Is code field text or numeric?
 
R

Rich

Guest
Try this
If Me.Code = "220" And Me.LocationOfOffense = "14" Or Me.LocationOfOffense ="19" Then
Cancel = True
PremisesEntered.SetFocus
Else: Forms!IncidentReport!CriminalActivity subform.Form.SetFocus

However since you will probably have to use the main form's before update event to trap this you will probably have to include the full forms! references

HTH
 

Users who are viewing this thread

Top Bottom