One Command button for different reports

How do I call up a specific report based on 2 fields on a form with a command 
button.
To explain myself.  I already have the form made, and on the form are the 
fields ContactID and ContractType.  I would like the create a command button 
on this form and when clicked it would open the report based on the ContactID 
and Contracttype (on the report will be the contacts mailing info, and the 
correct contract will be chosen because of the Contracttype) there are 5 
report possibilities.  The ContactID and Contracttype are fields on two 
different tables. 

I have 5 reports, each design is different.  I would like the form field 
‘Contracttype’ determine which report opens. The ContactID will supply the 
mailing address. 
For example:
ContractType=Gas then print Report ‘Gas’
ContractType=Electric then print Report ‘Electric
ContractType=Heat then print Report ‘Heat’ and so on. 
 
If I can get some help with the first two lines and how to finish the code I 
am most appreciative.
Frank

0
Utf
11/16/2007 2:24:01 PM
access.forms 6864 articles. 2 followers. Follow

2 Replies
741 Views

Similar Articles

[PageSpeed] 43

In the OnClick event for the command button insert some code to test the 
value of the other control. You can pass a value to the report via the 
OpenArgs. You can research OpenArgs via Access Help.
OnClick event:
Select case Me!ContractType
   Case "Gas"
        DoCmd.OpenReport "Gas", , , , , Me!ContactID
   Case "Heat"
        DoCmd.OpenReport "Heat", , , , , Me!ContactID
    etc. etc.
End Select

-Dorian

"Francis Cunningham, Jr." wrote:

> How do I call up a specific report based on 2 fields on a form with a command 
> button.
> To explain myself.  I already have the form made, and on the form are the 
> fields ContactID and ContractType.  I would like the create a command button 
> on this form and when clicked it would open the report based on the ContactID 
> and Contracttype (on the report will be the contacts mailing info, and the 
> correct contract will be chosen because of the Contracttype) there are 5 
> report possibilities.  The ContactID and Contracttype are fields on two 
> different tables. 
> 
> I have 5 reports, each design is different.  I would like the form field 
> ‘Contracttype’ determine which report opens. The ContactID will supply the 
> mailing address. 
> For example:
> ContractType=Gas then print Report ‘Gas’
> ContractType=Electric then print Report ‘Electric
> ContractType=Heat then print Report ‘Heat’ and so on. 
>  
> If I can get some help with the first two lines and how to finish the code I 
> am most appreciative.
> Frank
> 
0
Utf
11/16/2007 2:44:07 PM
When writing the following code I get a error message. "Run time error 438, 
Object does not support this property or method."
I don't know how to write code so I don't know If the , , , , ,  mean 
anything.
and I don't know how to end the code. If I knew the first full section and 
the last section I can fill in the middle.
Frank
"mscertified" wrote:

> In the OnClick event for the command button insert some code to test the 
> value of the other control. You can pass a value to the report via the 
> OpenArgs. You can research OpenArgs via Access Help.
> OnClick event:
> Select case Me!ContractType
>    Case "Gas"
>         DoCmd.OpenReport "Gas", , , , , Me!ContactID
>    Case "Heat"
>         DoCmd.OpenReport "Heat", , , , , Me!ContactID
>     etc. etc.
> End Select
> 
> -Dorian
> 
> "Francis Cunningham, Jr." wrote:
> 
> > How do I call up a specific report based on 2 fields on a form with a command 
> > button.
> > To explain myself.  I already have the form made, and on the form are the 
> > fields ContactID and ContractType.  I would like the create a command button 
> > on this form and when clicked it would open the report based on the ContactID 
> > and Contracttype (on the report will be the contacts mailing info, and the 
> > correct contract will be chosen because of the Contracttype) there are 5 
> > report possibilities.  The ContactID and Contracttype are fields on two 
> > different tables. 
> > 
> > I have 5 reports, each design is different.  I would like the form field 
> > ‘Contracttype’ determine which report opens. The ContactID will supply the 
> > mailing address. 
> > For example:
> > ContractType=Gas then print Report ‘Gas’
> > ContractType=Electric then print Report ‘Electric
> > ContractType=Heat then print Report ‘Heat’ and so on. 
> >  
> > If I can get some help with the first two lines and how to finish the code I 
> > am most appreciative.
> > Frank
> > 
0
Utf
11/16/2007 4:46:03 PM
Reply:

Similar Artilces:

can excel check one column against another
Hi. I have a spreadsheet with columns such as A, B, C, D, filled with numbers. Each row across such as row 1, then row 2, then row 3, etc of numbers is totaled in column E. Countless rows, each of which is totaled per row and then ends with a grand total at bottom of column E. Next comes columns F, G, H, also filled with numbers (but different numbers), which is totaled per row in Column I. At the bottom of Column I is a grand total. Even though arrived at using different sets of numbers, -both grand totals - in columns E and I must match. Sometimes they don't match. Ouch. So here is m...

scheduled payment report
The report we are looking for would let us put in a date range and sum up the columns for the interest, principal, etc paid during that period. It should contain the same information that is in the report when you click the printer icon from the payment schedule window. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and t...

why crash in the second method of one interface
Hi, Using one class generated from *.tlb to call 2 methods of one COM. The strange thing is that I got one error of the "First-chance exception in : 0xC0000005: Access Violation" in the second method. I also use ASP web page to call both methods of this COM and both methods seems is OK. ITemplateManage mytemplate; if (!mytemplate.CreateDispatch("comobj.TemplateManage")) { IDE_Error::Report (ComError|1,"ComObj.TemplateManage in FUN_Template::Add()"); return false; } result = mytemplate.Check (templatefilename); decodeparameter=mytemplate.GetInfo (templ...

Add signature to report
I'm trying to add a signature to a report. A form has a subform and a command button. The user picks from the subform clicks this command button and the report is displayed. (This works fine) stDocName = "rptThankYou" stLinkCriteria = "[ICNNo]='" & Me![ICNNo] & _ "' AND [ProvNo] = '" & Me!f_ProvSub!ProvNo & "'" DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria I'm trying to add a value for a signature.. I have added a combo box (Signature) which has the row source liked to the signature table. My quest...

quick key for the top left green button
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Hi there, <br><br>At the top left of the spread sheet is a green button to the right of the red button that close the screen. Does any one know of a quick key combination that emulates clicking the green button? <br><br>Thanks, Command+W Have a look in both Mac Help & Excel Help for keyboard shortcuts. <Dwade01@officeformac.com> wrote in message news:59bb6b61.-1@webcrossing.JaKIaxP2ac0... > Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: ...

MSR Credit Card Reader adds all the information on one line
Is there a way to get the CC reader to properly seperate the the acct # from the expiration date? When I swipe I currently get everything on the acct # line. Thanks in advance! What type of CC reader(MSR) to you have? Typically this is an issue with simply configuring the MSR. Rob "Steakum" wrote: > Is there a way to get the CC reader to properly seperate the the acct # from > the expiration date? When I swipe I currently get everything on the acct # > line. > > Thanks in advance! Its a IDTECH Minimag USB/Keyboard Interface Do I need to select the Wedge Key...

Duplicate Transactions, One When Pending, One When Posted
I'm sure this has been addressed, but I couldn't seem to find an answer searching: My problem is, a transaction occurs at my bank, and MM2K7 downloads the data for it. Once that transaction moves from "Pending" to "Posted" at my bank, the transaction data changes, so MM downloads it again. Sometimes I get a possible duplicate message from MM, sometimes I don't. What are people doing to handle this situation? Thank you. This is a problem with your bank, not with Money. Eventually they should fix it. Call them. In the meantime VOID the pending transacti...

grid off on one page
Is it possible to turn the grid off of only one page? thanks On Thu, 14 Feb 2008 10:37:11 -0600, "greg" <iuouh@ghfhg.com> wrote: >Is it possible to turn the grid off of only one page? Not really as it is a document wide setting.... however, there is workaround open the page shapesheet menu window -> Show shapesheet and set XGridSpacing and YGridSpacing to a large value. -- Regards, Paul Herber, Sandrila Ltd. SSADM for Visio http://www.saadm.sandrila.co.uk/ On Thu, 14 Feb 2008 16:47:53 +0000, Paul Herber <SubstituteMyFirstNameHere@pherber.com> wro...

Voting buttons
I lose my voting buttons when I send email across exchange servers , Huh? What do you mean by "Voting Buttons"? >-----Original Message----- >I lose my voting buttons when I send email across exchange servers , > > >. > ...

One to One relationship
I have an Events entity that is an offshoot from the Contacts entity. Basically, it tracks what events each contact has been invited to, and is used mainly by the Events Coordinator. I've set it up as a One (Contact) to Many (Events) relationship. However, I really only want one event form for each contact form. The reason I've set up a different entity rather than just adding a tab is that access to this entity needs to be tightly controlled. Obviously, if many events forms are created for the one contact, it would be very difficult to tell which one is accurate etc. Is it possibl...

Next Date given one date
At this time, I cannot use VBA. Here is my objective: For a given treasury note security: Cell A1, Date 6/17/2004 - today's date Cell A2, Date 7/15/1997 - first coupon date I want to identify the "previous coupon date" and "next coupon date" from today's date based on the frequency of the "first coupon date". Logically speaking: * Security pays 2 times each year * Based on first coupon date, pay dates are: 1/15 & 7/15 * Given today is 6/17/04, the next pay date is 7/15/04. * Given today is 6/17/04, the previous pay date is 1/15/04. Can this be...

Report writer
Hello, I am trying to add the transaction distribution details onto a copy of the PM Blank Document in Report Writer in GP 9. Would you pls advise as I can add the fields containing the data but the data is not appearing on the report. Thanks your comments are appreciated. -- chj@jup Once you were done modifying the report, did you give access to the mdoified report under Security? -- Lyle U chj wrote: > Hello, > > I am trying to add the transaction distribution details onto a copy > of the PM Blank Document in Report Writer in GP 9. Would you pls > advise as I c...

Loan Accounts in Reports
Bugs are in reports, the loan that I pay to my car is divided in 2, principal and interest, but in reports I can't show the two at same time, the reports show only the interest that I'm paying. The budget have the same problem with loans, it shows values that don't exists, I start a new budget, put all the values correctly and finalize it, when I go to budget home there are values that I not put there. There is some fix to those bugs? ...

Copy range C5:Lastrow and paste to two different worksheets
Good morning I cannot seem to find a solution to this, and hope someone might be able to help me. I have three worksheets: Ratios, Trades, Trades2 I am trying to find a vba method to select the Range C5:(the last row used in columnC) on the Ratios sheet, and copy and paste this range to Cells F11->down on the Trades and Trades2 Sheets. Please could someone provide a suggestion for this. I really do appreciate the help Regards, Paul Darn it, always pleasing when I manage to solve my own problem - but always concerned I may have wasted someones time by posti...

route inbound email from ip to one folder
Is there a way to route any incoming email from a certain IP address to a single folder? Our company is receiving emails from a source that we do not wish to receive, and would like these email to be directed to a singe folder rather than blocking them. Any ideas? Thanks. you could send them to the turf dir... http://support.microsoft.com/default.aspx?scid=kb;en-us;245465 "daine" <anonymous@discussions.microsoft.com> wrote in message news:11d501c4263d$f4d05110$a101280a@phx.gbl... > Is there a way to route any incoming email from a certain > IP address to a single ...

format the "date" button for a header
I need to insert a date in my header but not in the short format currently provided by pressing the "date" button. Is there a forumala etc that I can use that will change the format of this particular date without going through computer settings and chaning the "standard" date option. (much like how you can format a normal cell to show the date in whatever format you require You can use this macro: Public Sub DateInHeader() Dim ws As Worksheet For Each ws In ActiveWindow.SelectedSheets ws.PageSetup.LeftHeader = Format(Date, "dd m...

What macro is run by a button???
Gang, There is a little smiley face button put on the toolbar at one of our computers that runs a macro when pressed. How can we find out which macro is being run???? Thanks Lee Johnson One way, right click on any tool bar (or do tools>customize) and select customize, right click on the button and select assign macro, in the name of the macro is in the name box. For instance if the macro is stored in the personal.xls the name would look like PERSONAL.XLS!macroname now when you know where it is stored you can press Alt + F11 to open the VBE, select the workbook and double click th...

How to create vista glass buttons ?
Hello, i wish to create a glass button for my MFC application like those in Windows Media Player. can u guide me the basics of creating a new button in MFC. Thanks, Varun C.H "Tranquil2000" <varunc_h@hotmail.com> ha scritto nel messaggio news:%23uJhzrGJJHA.3424@TK2MSFTNGP05.phx.gbl... > i wish to create a glass button for my MFC application like those in > Windows Media Player. can u guide me the basics of creating a new button > in MFC. Hi, I think that Windows Media Player "glass buttons" are not part of standard Windows common controls. To ver...

Macros to Button
Can someone please tell me how to assign Macros to a Button? http://www.ozgrid.com/Excel/assign-macros.htm -- Regards Dave Hawley www.ozgrid.com "Premal" <Premal@discussions.microsoft.com> wrote in message news:026F76B8-CEC2-47B5-9581-66849F0627D8@microsoft.com... > Can someone please tell me how to assign Macros to a Button? Use buttons from the Forms toolbar (View|Toolbars in xl2003 menus) to see that toolbar. Then click on the button and plop it on a sheet somewhere. You'll be prompted to assign the macro right there. If you don't want...

Launching Reports from the Submit Order Button in 4.0
My client has several retail locations and they are using CRM in conjunction with their POS system. Therefore, CRM Orders has received a lot of customization to make it as slim, trim, and "Mouse-Click-Free" as possible. In the spirit of reducing even more mouse clicks, they have asked if we could launch a custom report (Basically the Order Report, renamed "Order Receipt") when the "Submit Order" button (re-named by Scribe's CRM to GP Integration) is clicked. The Receipt would render and then be printed for the cusomter. The report is context sensitive...

One client (Server 2k8-R2/HyperV) will not sync with DPM
We have been running DPM successfully for about a year now without any major problems. Recently we added a new server - a fairly robust PowerEdge that will be housing 4 HyperV VMs. For whatever reason, I can't get anything but the HyperV "Initial Store" to sync correctly. I thought initially it might be a problem with the HyperV machines, but it also fails to back up a small directory of files on the host drive. The oddest part about this is I really don't get an error. It will try an initial sync and run for a day or two and show very minimal data tr...

To view, specifically Units in one report
I have report with a Reporting Tree (9 Unit), when the report is generated, I select only two unit, but I need that the drill down show one report with these unit only If you want multiple units in a single report you will need to use the column layout with unit restrictions on multiple columns Leslie "Pedro" wrote: > I have report with a Reporting Tree (9 Unit), when the report is generated, I > select only two unit, but I need that the drill down show one report with > these unit only Leslie; Each Column layout have the unit restrictions Thanks :-) "Lesl...

Exchange 5.5 - One Organization
Hello - I am having a problem that I would like some more information on. I have One Organization (5.5) and 16 Sites (5.5) and would like to know why I can't stop the other sites from sending mail through me. If I can, I would like to know how. Thanks for any help. what do you mean by "sending mail through me"? What mail? Internet email? Does each site have its own Internet Mail Service? Or is your site kind of the "hub" where all Internet email comes in and goes out? -- Susan Conkey [MVP] "dave.mudgett" <davemudgett@discussions.microsoft....

See more than one tab at a time
I would like to be able to see more than one Tab at a time in Excel. Currently I'm able to see two Tabs from different worksheets, but not two or more tabs from the same worksheet On Sat, 28 Aug 2004 14:57:03 -0700, "rocky59" <rocky59@discussions.microsoft.com> wrote: >I would like to be able to see more than one Tab at a time in Excel. >Currently I'm able to see two Tabs from different worksheets, but not two or >more tabs from the same worksheet That would be because each tab represents a single worksheet. Clicking on the tab would move you from where ...

Assigning records to different Business Units
Hi I have created a CRM instance with multiple business units. One parent business unit and three child business units. This way the people in each business unit can see only the records pertaining to themselves, while the CEO and other management users can see records for all the business units. This works fine except that I cannot figure out a way to allow the management users in the parent business unit to be able to assign a record to one of the child business units. Is there a way to do this without creating new accounts for each management user in each child business unit? Thanks in ...