Difference criteria from different forms

  • Thread starter szag via AccessMonster.com
  • Start date
S

szag via AccessMonster.com

I have messed with this for a while now and can get it to work. I have two
different tabs (in a tab control) that have basically the same combo box
which is a "Job#". There is a report button next to each of the combo box's
that will run the same report. So if someone chose Job# ABC in tab 1 then
navigated over to tab 2 and chose Job # 123 then clicks the report button on
next to job# 123 the query criteria for "Job#" should use 123. however if
they went back to tab 1 and hit the report button next to Job ABC then the
query criteria for job# should use ABC.

So I want an event to fire off when the report button on tab 1 is clicked
that would have the report use the combo box in tab 1 the criteria and vice
versa. I can't seem to find the right code for the on click event.
 
M

Maurice

Szag,

Why not set the parameter when openening the report. This could look
something like this:

docmd.openreport "reportname",,, "job#= '" & me.combobox & "'"

if you are dealing with numerical values lose the apostrophs like:

docmd.openreport "reportname",,, "job#= " & me.combobox

replace the reportname with the name of your report and replace the job#
with the name you are using in the query and replace the me.combobox with the
name you are using for the combobox.

hth
 
S

szag via AccessMonster.com

this worked perfect. One small problem. If I add a subreport to this report
what would be the best way of assigning the link child field the same values
as Job# ?
Szag,

Why not set the parameter when openening the report. This could look
something like this:

docmd.openreport "reportname",,, "job#= '" & me.combobox & "'"

if you are dealing with numerical values lose the apostrophs like:

docmd.openreport "reportname",,, "job#= " & me.combobox

replace the reportname with the name of your report and replace the job#
with the name you are using in the query and replace the me.combobox with the
name you are using for the combobox.

hth
I have messed with this for a while now and can get it to work. I have two
different tabs (in a tab control) that have basically the same combo box
[quoted text clipped - 8 lines]
that would have the report use the combo box in tab 1 the criteria and vice
versa. I can't seem to find the right code for the on click event.
 

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