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

  • Thread starter Thread starter Vince
  • Start date Start date
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
 
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
 
Back
Top