Really Simple Form Filter Question

Stang70Fastback

Registered User.
Local time
Today, 18:43
Joined
Dec 24, 2012
Messages
132
So I'm tearing my hair out over a really STUPID problem:

I have a continuous form... and I want to filter the table in the background using the text box called "Badge" (boxed in red in my picture.) You can see the corresponding part over in the filter field. When I display the form, though, Access still asks me for the Badge value, so it's not linking. What formatting am I missing to properly refer to the field?
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    62.3 KB · Views: 148
You may want to have an AfterUpdate event for that Badge textbox that runs the VBA command

me.Refresh

Try that and see if it works.

Is CDLExam a table or a query, by the way?
 
That does not work. CDLExam is a Table. As soon as I open the form, I get the "Enter Parameter Value" textbox, so it's a problem with it understanding that [Badge] refers to the textbox called "Badge" on that form.
 
So when I do that, it does NOT ask me for a parameter value, so supposedly it's finding the text box, but it doesn't display ANY records, no matter what I type into the box.

And yet, when it WAS asking me for the parameter value, and I typed in a badge number that exists in the table, I DID get the right records. But now that it is (theoretically) finding the text box, even if I set the text box's default value to a badge number, no records appear. So confused.
 
So I solved it using the following code in the OnChange event for the Badge textbox:

Dim strFilter As String

Me.Refresh

strFilter = "EmBadge like '*" & Me.Badge & "*'"

Forms!CDLExamCONT.Form.Filter = strFilter
Forms!CDLExamCONT.Form.FilterOn = True

Me.Badge.SelStart = Nz(Len(Me.Badge), 0)
 

Users who are viewing this thread

Back
Top Bottom