form to enter criteria?

D

Debbie S.

Hi,

I have a database that has a table with customer information, a table with
order information, and a table with products. The customers and orders are
linked with a one to many, and likewise with products and orders.

I want to create a form for users to enter criteria that will then spit out
a report based on the criteria they entered. I have more questions about this
but I'll start with that one.

Thanks,
ds
 
J

Jeanette Cunningham

Hi Debbie,
there is a form you can download with all the code on www.allenbrowne.com
Look for the search form.
After your user selects the criteria from the combo and textboxes on that
form, you use the criteria as where criteria for open report.

Jeanette Cunningham
 
D

Debbie S.

Thank you Jeanette. I actually went to Allen Brown's Site and found his
search form. I tried to create one in my database, copying his code into my
form, but I got an error message: "Method or Data Member Not Found",
referring to a field name from my database that I had substituted for his
field name in part of the code ("txtFilterFieldName"). Not sure what to
do....my head is spinning at this point. I'd be grateful for any advice.

Thank you again.

Debbie
 
J

Jeanette Cunningham

Debbie,
access is trying to tell you that it can't find the control in that part of
the code.
First thing to do is to check all the changes you made to Allen's code
against the names of the controls on your form.
Access gives this message when the code is telling it to do something with
the control name but it can't find any control of that name on the form.

Here is an example.
I have code on my form that says Me.txtNewName set focus.
But I made a mistake with the name of the control and I named it as
txtNewNam.
When Access tries to set the focus to txtNewName it looks at the names of
all the controls on the form, it can't find txtNewName because I had named
it txtNewNam and it gives the error message about Data member not found.
When I change txtNewNam to txtNewName everything works OK

Jeanette Cunningham
 
D

Debbie S.

Thanks again Jeanette. I tried it again this morning with a different
control, "city." I got the same error message, pointing to this line of code:

If Not IsNull(Me.txtFilterCity) Then

I know that I spelled it correctly. I don't understand what I'm doing wrong.
Any further suggestions or ideas?

Thank you,
Debbie
 
J

Jeanette Cunningham

Debbie,
one way to sort this out is:
Make a copy of your search form, we will work on the copy.
On the copy, delete most of the controls used for searching until there is
only one left.
When we get the form working with just one search control, then you can add
another one, get that one working and so on.
Now change the code by removing all the code that refers to controls that
are not in this search form.
If you can't make it work with just one control, post back with your code.

Jeanette Cunningham
 
D

Debbie S.

Jeanette,
Thank you so much. I am working on this. If I run into problems I will
repost here. Thank you,
Debbie
 

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