Recordset Filter Combo Box

bogushs

Registered User.
Local time
Today, 05:59
Joined
May 4, 2005
Messages
27
Hi There. Im Trying To Filter Records Through A Combo Box Which Is So Far So Good. However What I Would Like To Do Is Select The Records Through The Combo Box And Have It Return And Populate Only Those Records. Has Anyone Got Any Suggestions To This?
Ive Attached The Sample Database Im Working On.

Cheers
 

Attachments

Dim sql As String
sql = "SELECT * FROM [qry Landuse Survey 2005] WHERE [STREET] = '" & Me![Combo255] & "'"
Me.RecordSource = sql

Place the above code in the AfterUpdate of your StreetName combobox.
I tried it and it does exactly what you do - ie. filter only those records
where the street name matches the value in your combobox.
 
Cheers Edtab

Works like a dream!!!
 
edtab said:
Dim sql As String
sql = "SELECT * FROM [qry Landuse Survey 2005] WHERE [STREET] = '" & Me![Combo255] & "'"
Me.RecordSource = sql

Place the above code in the AfterUpdate of your StreetName combobox.
I tried it and it does exactly what you do - ie. filter only those records
where the street name matches the value in your combobox.

Instead of '" & Me![Combo255] & "'", use """ & Me![Combo255] & """" - this stops the routine falling over if Combo255 has a ' in it such as O'Connor.
 

Users who are viewing this thread

Back
Top Bottom