Form -> Pull ID -> Run Query -> Run Report All in one click?

V

Vince

Hi,

I would like to know if anyone knows a code for a button
for the following need?

I am in a Data Entry Form which is linked to a table.
I need to run a report that is based no a Query.
My problem is I would like to know a code that when I
click the button it will simply insert the current form
records TransID into a query which will open the report
that it is based on....


Recap chaos:

All records have a unique - TransID
The query is called - QEditFP
The report is called - REditFP

PLEASE and thanks again to EVERY helping professionals!!!

Vince
 
J

John Vinson

My problem is I would like to know a code that when I
click the button it will simply insert the current form
records TransID into a query which will open the report
that it is based on....

Two ways:

- Edit the Query and set the Criterion on the query field to

=Forms![NameOfYourForm]![TransID]

- Or, edit the Click event of the wizard-generated code to include:

Dim strSQL As String
....
strSQL = "[TransID] =" & Me![TransID]
DoCmd.OpenReport stDocName, WhereCondition:=strSQL
 

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