Filtering Records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any way I can filter Records using a combo box & the Event Procedure
OnChange?
 
I've tried that but I can't seem to enter the correct code, any ideas on
filter code? Sorry to be a pain!
 
Hi John - no problem. Try this. Create a simple form based on any table with
a primary field. Use the combo box wizard to drop down an unbound control at
the top of the field.
-When the combo box wizard comes up use the "Find a record on my form based
on the value I selected in my combo box" radio option.
-Choose the primary key and a descriptor field.
-Name the label "Find record"
This will create code in the after update event that looks like this:

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.Find "[PrimeKey] = '" & Me![Combo10] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

where Combo10 is the name of the new combo box and [PrimeKey] is the name of
the primary key in the table of the bound form.

LOL. I hope this helps.

Best.
- AbeR
 
Thank you very much Abe, very helpful indeed.

Cheers.

AbeR said:
Hi John - no problem. Try this. Create a simple form based on any table with
a primary field. Use the combo box wizard to drop down an unbound control at
the top of the field.
-When the combo box wizard comes up use the "Find a record on my form based
on the value I selected in my combo box" radio option.
-Choose the primary key and a descriptor field.
-Name the label "Find record"
This will create code in the after update event that looks like this:

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.Find "[PrimeKey] = '" & Me![Combo10] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

where Combo10 is the name of the new combo box and [PrimeKey] is the name of
the primary key in the table of the bound form.

LOL. I hope this helps.

Best.
- AbeR
JohnC said:
I've tried that but I can't seem to enter the correct code, any ideas on
filter code? Sorry to be a pain!
 
Back
Top