Filtering on a Form

D

dcole

I'm trying to create a form for looking up customers. The form
includes things like name, company, address, etc. It's based off of
the Customer table.

I have an unbound text box called Filter_BillCustID. I want someone to
be able to enter a customer ID into this box, and the form then runs a
filter that pulls all records where BillCustID = Filter_BillCustID.

I have the AfterUpdate event of the Filter_BillCustID box as:

Me.Filter = "BillCustID = Filter_BillCustID"
Me.FilterOn = True

But for some reason, when I enter a value into the box and hit ENTER,
I got an "Enter Parameter Value" popup that asks for the value of
Filter_BillCustID. If I type in the value into this popup, it works
fine.

Why is it asking me to reenter the value into the popup?

Thanks!
 
C

Carl Rapson

I'm trying to create a form for looking up customers. The form
includes things like name, company, address, etc. It's based off of
the Customer table.

I have an unbound text box called Filter_BillCustID. I want someone to
be able to enter a customer ID into this box, and the form then runs a
filter that pulls all records where BillCustID = Filter_BillCustID.

I have the AfterUpdate event of the Filter_BillCustID box as:

Me.Filter = "BillCustID = Filter_BillCustID"
Me.FilterOn = True

But for some reason, when I enter a value into the box and hit ENTER,
I got an "Enter Parameter Value" popup that asks for the value of
Filter_BillCustID. If I type in the value into this popup, it works
fine.

Why is it asking me to reenter the value into the popup?

Thanks!

You need to concatenate the value onto your filter string:

Me.Filter = "BillCustID = " & Filter_BillCustID

Carl Rapson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top