One Command Button for different reports

  • Thread starter Francis Cunningham, Jr.
  • Start date
F

Francis Cunningham, Jr.

I am not sure if I am in the right Discussion Group, so here it is...
I have five different queries called ‘Cooling, Electric, Gas, Heat Pump and
Oil’
I would like to create a one command button on a form called ‘Contract’,
that based on two fields on this form, called ‘ContractNumber’ and
‘ContractType’ will generate the specific report. The ContractNumber is
unique (primary key, required and no duplicates allowed) to the form
‘Contract’. So based on the ContractNumber and the ContractType on the query
I would like the result to be the correct query or report for the record.
Can someone help?
Frank
 
P

pietlinden

I am not sure if I am in the right Discussion Group, so here it is...
I have five different queries called ‘Cooling, Electric, Gas, Heat Pump and
Oil’
I would like to create a one command button on a form called ‘Contract’,
that based on two fields on this form, called ‘ContractNumber’ and
‘ContractType’ will generate the specific report. The ContractNumber is
unique (primary key, required and no duplicates allowed) to the form
‘Contract’. So based on the ContractNumber and the ContractType on thequery
I would like the result to be the correct query or report for the record.
Can someone help?
Frank

Create the unfiltered report as usual.
Then create a button on your form to open the report for only the
active record.
One of the arguments for the OpenReport command is a filter, which is
just a valid WHERE clause without the "Where" keyword. Albert Kallal
has a nice example on his website.

IF you want, create a macro that does it, then convert it to VBA
(right-click, save as Module).
 

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