Pass variable from one query to another

R

rbeach

I have a report that runs on one query to view the status of orders. When the
report is closed I run another query that is identical to the query for the
report but is an update query. I enter the PO number and date on the original
query and would like to store this to automatcally enter in the update query
dialog boxes. The items are [Enter StartDate], [Enter EndDate] and [Select
PONumber] on both queries.
 
D

dymondjack

Have you tried building your update query off of your select query? Queries
can be build from other queries, not just tables, so if your update query was
based off the select query, you would only update those records that you have
just viewed (providing no information has changed/will change between the
time you run both queries).
--
Jack Leach
www.tristatemachine.com

- "A designer knows he has reached perfection not when there is nothing left
to add, but when there is nothing left to take away." - Antoine De Saint
Exupery
 
R

rbeach

This is a query run off the original query and is an update query. Below is
the "On Close" programming I have in place. This still pops up with the boxes
for the StartDate, EndDate and PO Number when the report is closed. The
programming works fine, but I want the information entered firts to
automatically be entered for the close query.

Dim Hold As Variant

Hold = InputBox("Type YES to mark these items as Billed", "Enter YES if to
be marked billed")

If Hold = "YES" Then
DoCmd.SetWarnings False
DoCmd.OpenQuery "QueryUpdateBilledField"
DoCmd.SetWarnings True
End If

--
Rick


dymondjack said:
Have you tried building your update query off of your select query? Queries
can be build from other queries, not just tables, so if your update query was
based off the select query, you would only update those records that you have
just viewed (providing no information has changed/will change between the
time you run both queries).
--
Jack Leach
www.tristatemachine.com

- "A designer knows he has reached perfection not when there is nothing left
to add, but when there is nothing left to take away." - Antoine De Saint
Exupery


rbeach said:
I have a report that runs on one query to view the status of orders. When the
report is closed I run another query that is identical to the query for the
report but is an update query. I enter the PO number and date on the original
query and would like to store this to automatcally enter in the update query
dialog boxes. The items are [Enter StartDate], [Enter EndDate] and [Select
PONumber] on both queries.
 
P

pietlinden

I have a report that runs on one query to view the status of orders. Whenthe
report is closed I run another query that is identical to the query for the
report but is an update query. I enter the PO number and date on the original
query and would like to store this to automatcally enter in the update query
dialog boxes. The items are [Enter StartDate], [Enter EndDate] and [Select
PONumber] on both queries.

One option is to enter the Start Date, End Date and PO Number values
into unbound textboxes/comboboxes and then run the report from a
button on a form then just close the form in the Open event of the
report.
 
R

rbeach

This is not a Form. This is a Report. Once it is printed I want the values to
be updated if the operator types YES in the dialog box.
--
Rick


I have a report that runs on one query to view the status of orders. When the
report is closed I run another query that is identical to the query for the
report but is an update query. I enter the PO number and date on the original
query and would like to store this to automatcally enter in the update query
dialog boxes. The items are [Enter StartDate], [Enter EndDate] and [Select
PONumber] on both queries.

One option is to enter the Start Date, End Date and PO Number values
into unbound textboxes/comboboxes and then run the report from a
button on a form then just close the form in the Open event of the
report.
 
R

rbeach

I have created a form with a button that runs the query using the text boxes
from the form. This works great, and if I don't close the form, the update
query works properly also when closing out of the report.

Thanks for all your help.
--
Rick


I have a report that runs on one query to view the status of orders. When the
report is closed I run another query that is identical to the query for the
report but is an update query. I enter the PO number and date on the original
query and would like to store this to automatcally enter in the update query
dialog boxes. The items are [Enter StartDate], [Enter EndDate] and [Select
PONumber] on both queries.

One option is to enter the Start Date, End Date and PO Number values
into unbound textboxes/comboboxes and then run the report from a
button on a form then just close the form in the Open event of the
report.
 

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