form filter

gruebz

Registered User.
Local time
Today, 16:05
Joined
Feb 4, 2008
Messages
10
i have a simple form that I want to filter on the update of a combo box.

i use the following code
Code:
Me.Filter = "Me.TxtCbo.Value=" & TableValue
Me.FilterOn = True
where TxtCbo is a Text Box on the form and TableValue is a string variable that is set earlier in the code based on what choice the user chooses from the combo box.

The filter doesn't seem to work. I'm sure I've just made a small syntax error. Any help is much appreciated.
 
Simple Software Solutions

Take out the quotation marks from around the .Filter string and that should work.

CodeMaster::cool:
 
it keeps on giving me a invalid use of null message and upon debugging it keeps on saying that [TxtCbo] is null. however, txtcbo definitely has a values in it?
 
strings HAVe to be surrounded in "" marks
i find usiing chr(34) is less ambiguous so

(and you dont need the me's everywhere)

Filter = "TxtCbo = " & chr(34) & TableValue & chr(34)

However, txtcbo may be the problem - I think you need to filter on the name of the field in the underlying dataset, NOT on the cbo control name so its more likely to be

Filter = "Status = " & chr(34) & TableValue & chr(34)

or whatever
 
brilliant.... thanks heaps for your help
 

Users who are viewing this thread

Back
Top Bottom