A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Difference criteria from different forms



 
 
Thread Tools Display Modes
  #1  
Old February 15th, 2010, 08:15 PM posted to microsoft.public.access.forms
szag via AccessMonster.com
external usenet poster
 
Posts: 99
Default Difference criteria from different forms

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.

--
Message posted via http://www.accessmonster.com

  #2  
Old February 15th, 2010, 09:01 PM posted to microsoft.public.access.forms
Maurice
external usenet poster
 
Posts: 1,585
Default Difference criteria from different forms

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
--
Maurice Ausum


"szag via AccessMonster.com" wrote:

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.

--
Message posted via http://www.accessmonster.com

.

  #3  
Old February 15th, 2010, 09:34 PM posted to microsoft.public.access.forms
szag via AccessMonster.com
external usenet poster
 
Posts: 99
Default Difference criteria from different forms

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# ?

Maurice wrote:
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.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201002/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:20 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.