First of all, I want to thank you for all the time you're spending helping
me. I really appreciate it. OK, now for my database. I'm going to explain
the whole thing to you. I've enclosed a screenshot of the relationships. I
have a main form with a sub form. The main form has the information of the
OrderID, the VendorID combobox, and the Vendor information. The sub form has
the details of the order; the quantity, department, location, ProductID
combobox, unit price and line total. The main form then has the total of the
line total subform, freight charges and grand total. If you enter a vendor
that is not on the list, an error message comes up to tell you that. You can
then double click on the Vendor field and another form, "Vendors" will come
up for you to add the Vendor. If you add a product that is not on the list,
an error message comes up as well to tell you that. You can then double
click on the Product field and a "Product" form opens for you to add the new
product. I now want the user to be able to search for orders based on the
fact that they don't know the order number or any of the details. For
instance, if they know that they bought paper but don't remember anything
else, I have created a form based on a parameter query. (I will eventually
put a button on a "Search" toolbar for that and other parameter queries that
I make based on Vendor, location, etc. I also might put a control button
directly on the main form instead, I'm not sure. Anyway, when the user
clicks on the "button" that will open this form based on the parameter
query, it will ask for the criteria. "Enter the Product" for instance. When
they enter "paper" it will bring up....let's say 8 records. The fields they
will see will just be basic info. The OrderID, Date, Location, Department,
VendorID, UnitPrice. If they want to see the entire order, I want them to be
able to double click on the OrderID field, and some form or query (perhaps
my main form??) will pop up displaying that particular order. That's pretty
much it in a nutshell. Thanks again for your help.
Ken Snell said:
OK - let me state what I'm understanding about your setup and ask a few more
clarifying questions.
You open the first form (I'll call it Form1). Its recordsource query asks
you to enter a product ID (it's a parameter query). You enter this product
ID and Form1 displays all orderID values in datasheet view.
You have a second form (I'll call it Form2). Does this Form2 have a subform
on it? What does this subform display? The recordsource for Form2 is a query
that is based on OrderDetails table. Form2 contains a combo box whose
RowSource query is one based on Products table and a combo box whose
RowSource query is one based on Vendors table. It also has other controls
based on the fields in the OrderDetails table.
Is Form2 the one that is to open and display the record associated with the
OrderID record that you double-click in Form1?
--
Ken Snell
<MS ACCESS MVP>
Marie said:
I created a parameter query like I told you. Then I created a form
based
on
the query. When you open the form, it asks you to enter a product. I have
the form in datasheet view so that you can see all the records at one time
and select the one you want. The query I created is based on an Order
Details table, which has a link to an Order Table by OrderID, a Products
table by ProductID, (which is a combo box), and a VendorID (which is
also
a
combo box). This is also the table I used to base a query for my
subform.
Am
I supposed to be using 2 different queries; the one I made and the one you
told me to make? If so, how do I use both at the same time? Also, you said
to create a form. How do I use both your form and mine at the same time?
Marie
Sorry for the confusion.
You should leave your first query unchanged. It'll be used exactly as
you're
now using it. This assumes that you're displaying the list of OrderID
values
on a form (are you doing this in a combo box; list box; continuous forms
view on a form?).
You need to create a second query that will return the record for the
selected Order ID value. This second query needs to use the control
reference that I'd given to you as its criterion expression.
Post back with a bit more info about how you run the first query (do you
click a command button on a form, for example?) and how you display the
results of that first query.
--
Ken Snell
<MS ACCESS MVP>
Thank you both for your responses. I tried what you said, Ken, and it
isn't
working. I probably don't fully understand your answer. I'll try to
explain
in detail what I did. I created a parameter query in my original
database
named FindProductQry. For the criteria in the Product field I put Like
"*"
& [Enter the Product Name] & "*". Based on that query, if someone
entered
"Paper", a few records would be found. I then want the user to be able
to
double click on the OrderID field to bring up the order they
intend
response,
I
wasn't
sure if I was using my original query at all. If I added your criteria
[Forms]![frmOrders]![cboOrderID] to my original query (as well as my
product criteria), it asked for cboOrderID as the input. When I created
a
new query and form as you said, a form opened with no info. I
guess
I'm
just
not understanding what you said. I would appreciate if you can further
clarify the information. (I'm not that good with Access). Thanks.
I have created a form that is based on a parameter query to
lookup