Pass Dialog Box entry to new Query Dialog Boxes

R

rbeach

I have a report that runs on one query to view the status of orders. When the
report is closed I have the below programming in place to automatically
update the orders as billed if YES is typed in the dialog box. This is an
update query run off of the query for the report. I enter the PO number and
date on the original
query and would like to store this and automatcally enter this in the update
query
dialog boxes. The items are [Enter StartDate], [Enter EndDate] and [Select
PONumber] on both queries.

Below is the code used in the "On Close"

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

Appreciate any input,
 
R

rbeach

Then your suggestion is...................
--
Rick


Duane Hookom said:
Another good reason to never use parameter prompts in queries.
http://www.tek-tips.com/faqs.cfm?fid=6763.

Always use controls on forms for user interaction.

--
Duane Hookom
Microsoft Access MVP


rbeach said:
I have a report that runs on one query to view the status of orders. When the
report is closed I have the below programming in place to automatically
update the orders as billed if YES is typed in the dialog box. This is an
update query run off of the query for the report. I enter the PO number and
date on the original
query and would like to store this and automatcally enter this in the update
query
dialog boxes. The items are [Enter StartDate], [Enter EndDate] and [Select
PONumber] on both queries.

Below is the code used in the "On Close"

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

Appreciate any input,
 
R

rbeach

This is on a Report, not a form. I need to print the report and then update
the table.
--
Rick


Duane Hookom said:
Another good reason to never use parameter prompts in queries.
http://www.tek-tips.com/faqs.cfm?fid=6763.

Always use controls on forms for user interaction.

--
Duane Hookom
Microsoft Access MVP


rbeach said:
I have a report that runs on one query to view the status of orders. When the
report is closed I have the below programming in place to automatically
update the orders as billed if YES is typed in the dialog box. This is an
update query run off of the query for the report. I enter the PO number and
date on the original
query and would like to store this and automatcally enter this in the update
query
dialog boxes. The items are [Enter StartDate], [Enter EndDate] and [Select
PONumber] on both queries.

Below is the code used in the "On Close"

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

Appreciate any input,
 
D

Douglas J. Steele

Duane's suggestion (with which I concur) is to have a form with controls on
it and refer to those controls in your query, rather than simply having
pop-up prompts.

In the reference he cites, the example is don't have

SELECT tblSales.*
FROM tblSales
WHERE SaleDate Between [Enter Start Date] and [Enter End Date]

Instead, have

SELECT tblSales.*
FROM tblSales
WHERE SaleDate Between Forms!frmDates![txStartDate] and
Forms!frmDates![txtEndDate]

Note, too, that the controls don't have to be text boxes. Your form can have
calendar controls on it to allow the users to pick the dates, or combo boxes
or list boxes or option groups to limit what's selected.

You mention elsethread that "This is on a Report, not a form. I need to
print the report and then update the table." Your report can open the form
if you like, or you can open the form first and have it open the report for
you.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


rbeach said:
Then your suggestion is...................
--
Rick


Duane Hookom said:
Another good reason to never use parameter prompts in queries.
http://www.tek-tips.com/faqs.cfm?fid=6763.

Always use controls on forms for user interaction.

--
Duane Hookom
Microsoft Access MVP


rbeach said:
I have a report that runs on one query to view the status of orders.
When the
report is closed I have the below programming in place to automatically
update the orders as billed if YES is typed in the dialog box. This is
an
update query run off of the query for the report. I enter the PO
number and
date on the original
query and would like to store this and automatcally enter this in the
update
query
dialog boxes. The items are [Enter StartDate], [Enter EndDate] and
[Select
PONumber] on both queries.

Below is the code used in the "On Close"

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

Appreciate any input,
 
R

rbeach

Douglas,

Now I know what is needed and this works great.
--
Rick


Douglas J. Steele said:
Duane's suggestion (with which I concur) is to have a form with controls on
it and refer to those controls in your query, rather than simply having
pop-up prompts.

In the reference he cites, the example is don't have

SELECT tblSales.*
FROM tblSales
WHERE SaleDate Between [Enter Start Date] and [Enter End Date]

Instead, have

SELECT tblSales.*
FROM tblSales
WHERE SaleDate Between Forms!frmDates![txStartDate] and
Forms!frmDates![txtEndDate]

Note, too, that the controls don't have to be text boxes. Your form can have
calendar controls on it to allow the users to pick the dates, or combo boxes
or list boxes or option groups to limit what's selected.

You mention elsethread that "This is on a Report, not a form. I need to
print the report and then update the table." Your report can open the form
if you like, or you can open the form first and have it open the report for
you.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


rbeach said:
Then your suggestion is...................
--
Rick


Duane Hookom said:
Another good reason to never use parameter prompts in queries.
http://www.tek-tips.com/faqs.cfm?fid=6763.

Always use controls on forms for user interaction.

--
Duane Hookom
Microsoft Access MVP


:

I have a report that runs on one query to view the status of orders.
When the
report is closed I have the below programming in place to automatically
update the orders as billed if YES is typed in the dialog box. This is
an
update query run off of the query for the report. I enter the PO
number and
date on the original
query and would like to store this and automatcally enter this in the
update
query
dialog boxes. The items are [Enter StartDate], [Enter EndDate] and
[Select
PONumber] on both queries.

Below is the code used in the "On Close"

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

Appreciate any input,
 

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