Parameter Query

  • Thread starter Thread starter Marie
  • Start date Start date
M

Marie

I have created a form that is based on a parameter query to lookup a product
in a Purchase Order Database. I want the user to be able to go to the order
in question by double clicking on the Order ID number. I was hoping that the
user can double click on the PO # field, and the main order form would open
displaying the correct Order Number. Can this be done? Thank you.

Marie
 
yes, it should be possible. but i can't think how to tell
you without seeing your db. if nobody else posts a
solution for you, you're welcome to email a copy of your
db to me and i'll take a look at it. if you decide to do
this, compact your db, zip if necessary to under 2 MB and
put Access Newsgroups in the email subject line so my spam
filter doesn't toss it out.
 
If I understand correctly, you have a form that displays a list of records
related to Order ID values. You wish to doubleclick on the control that
displays the Order ID value desired and have a second form open that
displays records related to the Order ID?

If this is what you want, there is an easier way to do this.

Create a query that will return the records that you want to display on the
form, based on the Order ID value. In the Criterion box for the Order ID
field, put this expression :
[Forms]![frmOrders]![cboOrderID]

Save the query and name it qryOrders.

Create a form and name it frmOrders. Put a combo box (name it cboOrderID) in
the form's header. The combo box should be unbound. Use as its row source a
query that gives you a list of all Order ID values (do this in the
Properties window).

Set the form's View to Continuous Forms view (do this in the Properties
window). Set the form's record source to qryOrders. Put controls in the
Detail section that are bound to the fields in the qryOrders query.

While in the design view, click on the cboOrderID combo box. Then, in the
Properties window, click on Event tab, then click in box next to After
Update, then on the "..." box at far right of this box. Select "Code
Builder" (if asked). You'll then see the Visual Basic Editor opened, with
three lines displayed:

Private Sub cboOrderID_AfterUpdate()

End Sub

The cursor will be on the second (blank) line. On this blank line, type the
following:
Me.Requery

Save and close the form.

Now, when you open the form, the combo box will be available for you to
select an Order ID value. After you select it, the form then will display
the records associated to this Order ID.

(This also can be set up using the Wizard while in the design view of the
form when you select a combo box control.)
 
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>

Marie said:
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 to see.
The columns are OrderID, OrderDate, VendorID (a combo box), Department,
Location, ProductID (a combo box), and UnitPrice. In your 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.

Marie said:
I have created a form that is based on a parameter query to lookup a product
in a Purchase Order Database. I want the user to be able to go to the order
in question by double clicking on the Order ID number. I was hoping that the
user can double click on the PO # field, and the main order form would open
displaying the correct Order Number. Can this be done? Thank you.

Marie
 
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


Ken Snell said:
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>

Marie said:
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 to see.
The columns are OrderID, OrderDate, VendorID (a combo box), Department,
Location, ProductID (a combo box), and UnitPrice. In your 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 I'm
just
 
OK -

You should be able to use the main form and its subform for displaying the
chosen OrderID records, once you choose the OrderID record in the "Product"
form.

What you would do is to use code in the Product form. Assuming that you are
using the double-click event of the OrderID control on the Product form to
make the selection of the OrderID, you could put code similar to this on
that event of the OrderID control:

Private Sub OrderID_DblClick(Cancel As Integer)
Forms!Orders!OrderID.Value = Me.OrderID.Value
Forms!Orders!orderdetailsSubform.Form.Requery
DoCmd.Close acForm, Me.Name
End Sub

Where you replace orderdetailsSubform with the actual name of the subform
control (the control that holds the subform) on the Orders main form.

This will write the chosen OrderID value into the Orders main form, and then
requery the subform so that it shows the desired records.
--
Ken Snell
<MS ACCESS MVP>



Marie said:
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
 
OK, I tried what you said and the message I get is "Runtime Error 2450
Microsoft Access can't find the form 'POOrders" referred to in a macro
expression or Visual Basic Code. This is exactly what code I put in the
DoubleClick event of my parameter query form in the OrderID field:

Private Sub OrderID_DblClick(Cancel As Integer)
Forms!POOrders!OrderID.Value = Me.OrderID.Value
Forms!POOrders!POOrdersSubForm.Form.Requery
DoCmd.Close acForm, Me.Name
End Sub

What did I do wrong? I'm sorry to keep bothering you.

Marie


POOrders is the name of my main form and POOrdersSubForm is the name
Ken Snell said:
OK -

You should be able to use the main form and its subform for displaying the
chosen OrderID records, once you choose the OrderID record in the "Product"
form.

What you would do is to use code in the Product form. Assuming that you are
using the double-click event of the OrderID control on the Product form to
make the selection of the OrderID, you could put code similar to this on
that event of the OrderID control:

Private Sub OrderID_DblClick(Cancel As Integer)
Forms!Orders!OrderID.Value = Me.OrderID.Value
Forms!Orders!orderdetailsSubform.Form.Requery
DoCmd.Close acForm, Me.Name
End Sub

Where you replace orderdetailsSubform with the actual name of the subform
control (the control that holds the subform) on the Orders main form.

This will write the chosen OrderID value into the Orders main form, and then
requery the subform so that it shows the desired records.
--
Ken Snell
<MS ACCESS MVP>



Marie said:
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>

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
to
see.
The columns are OrderID, OrderDate, VendorID (a combo box),
Department,
Location, ProductID (a combo box), and UnitPrice. In your
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
a
product
in a Purchase Order Database. I want the user to be able to go to
the
order
in question by double clicking on the Order ID number. I was hoping
that
the
user can double click on the PO # field, and the main order form
would
open
displaying the correct Order Number. Can this be done? Thank you.

Marie
 
Is POOrders the name of the main form? Or the name of the form that is the
subform on the main form? Or have you misspelled the name?

If the former, then I am puzzled why it won't work (assuming that the form
is open when the code runs).

If the latter, then you must change your reference because you cannot access
a subform on its own -- it's not open on its own, so you reference it via
the main form.

However, before I give you that example reference, if POOrders is the
subform, you don't want to put the OrderID value into it anyway. You want to
put it into the control on the main form, and then requery the subform.

A bit more info please.
--
Ken Snell
<MS ACCESS MVP>


Marie said:
OK, I tried what you said and the message I get is "Runtime Error 2450
Microsoft Access can't find the form 'POOrders" referred to in a macro
expression or Visual Basic Code. This is exactly what code I put in the
DoubleClick event of my parameter query form in the OrderID field:

Private Sub OrderID_DblClick(Cancel As Integer)
Forms!POOrders!OrderID.Value = Me.OrderID.Value
Forms!POOrders!POOrdersSubForm.Form.Requery
DoCmd.Close acForm, Me.Name
End Sub

What did I do wrong? I'm sorry to keep bothering you.

Marie


POOrders is the name of my main form and POOrdersSubForm is the name
Ken Snell said:
OK -

You should be able to use the main form and its subform for displaying the
chosen OrderID records, once you choose the OrderID record in the "Product"
form.

What you would do is to use code in the Product form. Assuming that you are
using the double-click event of the OrderID control on the Product form to
make the selection of the OrderID, you could put code similar to this on
that event of the OrderID control:

Private Sub OrderID_DblClick(Cancel As Integer)
Forms!Orders!OrderID.Value = Me.OrderID.Value
Forms!Orders!orderdetailsSubform.Form.Requery
DoCmd.Close acForm, Me.Name
End Sub

Where you replace orderdetailsSubform with the actual name of the subform
control (the control that holds the subform) on the Orders main form.

This will write the chosen OrderID value into the Orders main form, and then
requery the subform so that it shows the desired records.
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.




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>

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
to
see.
The columns are OrderID, OrderDate, VendorID (a combo box),
Department,
Location, ProductID (a combo box), and UnitPrice. In your 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
 
POOrders is the name of my main form, and POOrdersSubForm is the name of the
subform that was incorporated into the main form. Then there is the form
"Products" with just the ProductName and ProductID, which is autonumber.
When I have the main form open, the subform is visible at the bottom of the
main form. If you double click on the Product field in the subform, the
Product form opens, I enter the Product name, close the product form and
proceed to enter the product on the subform of the main form.

Marie




Ken Snell said:
Is POOrders the name of the main form? Or the name of the form that is the
subform on the main form? Or have you misspelled the name?

If the former, then I am puzzled why it won't work (assuming that the form
is open when the code runs).

If the latter, then you must change your reference because you cannot access
a subform on its own -- it's not open on its own, so you reference it via
the main form.

However, before I give you that example reference, if POOrders is the
subform, you don't want to put the OrderID value into it anyway. You want to
put it into the control on the main form, and then requery the subform.

A bit more info please.
--
Ken Snell
<MS ACCESS MVP>


Marie said:
OK, I tried what you said and the message I get is "Runtime Error 2450
Microsoft Access can't find the form 'POOrders" referred to in a macro
expression or Visual Basic Code. This is exactly what code I put in the
DoubleClick event of my parameter query form in the OrderID field:

Private Sub OrderID_DblClick(Cancel As Integer)
Forms!POOrders!OrderID.Value = Me.OrderID.Value
Forms!POOrders!POOrdersSubForm.Form.Requery
DoCmd.Close acForm, Me.Name
End Sub

What did I do wrong? I'm sorry to keep bothering you.

Marie


POOrders is the name of my main form and POOrdersSubForm is the name
you
are
form
to and
then relationships. of
the
total
of on
the them
to a
few
is
product.
(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
to
see.
The columns are OrderID, OrderDate, VendorID (a combo box),
Department,
Location, ProductID (a combo box), and UnitPrice. In your
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
to
go order
form
 
Is POOrdersSubForm the name of the subform control that is on the main form?
You need to use the actual name of that control (the control that holds the
subform, which may or may not be the same name as the control's SourceObject
[which is the name of the form that is being used as a subform]) in your
reference.
--
Ken Snell
<MS ACCESS MVP>


Marie said:
POOrders is the name of my main form, and POOrdersSubForm is the name of the
subform that was incorporated into the main form. Then there is the form
"Products" with just the ProductName and ProductID, which is autonumber.
When I have the main form open, the subform is visible at the bottom of the
main form. If you double click on the Product field in the subform, the
Product form opens, I enter the Product name, close the product form and
proceed to enter the product on the subform of the main form.

Marie




Ken Snell said:
Is POOrders the name of the main form? Or the name of the form that is the
subform on the main form? Or have you misspelled the name?

If the former, then I am puzzled why it won't work (assuming that the form
is open when the code runs).

If the latter, then you must change your reference because you cannot access
a subform on its own -- it's not open on its own, so you reference it via
the main form.

However, before I give you that example reference, if POOrders is the
subform, you don't want to put the OrderID value into it anyway. You
want
to
put it into the control on the main form, and then requery the subform.

A bit more info please.
--
Ken Snell
<MS ACCESS MVP>


displaying
the form
this
information
of sub
form total that.
You add
the
ask
have
Form2
is product. (which record
for I'll
try
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
to
see.
The columns are OrderID, OrderDate, VendorID (a combo box),
Department,
Location, ProductID (a combo box), and UnitPrice. In your
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.
 
Back
Top