Filter records by postcode on form load

Shredsec.com

New member
Local time
Yesterday, 17:30
Joined
Jan 21, 2013
Messages
6
This is the code I'm attempting to use to to filter records by postcode. The idea is that a form only displays records from my table with postcode CB1 or CB2. Can't seem to get it to work.

Private Sub Form_Open()
Me.Filter = "[Postcode split]" = CB1 Or CB2
Me.FilterOn = True
End Sub
 
Hello Shredsec, try..
Code:
Private Sub Form_Open()
      Me.Filter = "[Postcode split] = 'CB1' Or [Postcode split] = 'CB2'"
      Me.FilterOn = True
End Sub
 
I'm getting this error message:

The Expression On Open you entered as the event property setting produced the following error: Procedure declaration does not match description of event or procedure having the same name
 
Oops, I just copied your code.. I did not look into the procedure declaration.. It should be..
Code:
Private Sub Form_Open([COLOR=Red][B]Cancel As Integer[/B][/COLOR])
 

Users who are viewing this thread

Back
Top Bottom