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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Option Group and Combo Box
Can someone help me out here?? I have a combo box with a list of departments
on it...and I have an option group listing the different reports. I want the user to pick a department and then a report and have it open for that specific department. The code works but it pops up the "enter the parameter value" dialogue and I have to re-type the department...both strange and tedious to the user. Here is my code Dim reportname If Me!Action = 1 Then reportname = "Rpt_PaperworkIncomplete" If Me!Action = 2 Then reportname = "Rpt_TBD" If Me!Action = 3 Then reportname = "Rpt_TBD" If Me!Action = 4 Then reportname = "Rpt_TBD" If Me!Action = 5 Then reportname = "Rpt_TBD" Dim stLinkCriteria As String stLinkCriteria = "[Position]=" & "" & Me![lkp] & "" DoCmd.OpenReport reportname, acViewPreview, , stLinkCriteria PLEASE HELP |
#2
|
|||
|
|||
Option Group and Combo Box
On Mon, 25 Jan 2010 12:21:01 -0800, ScubaDee
wrote: Can someone help me out here?? I have a combo box with a list of departments on it...and I have an option group listing the different reports. I want the user to pick a department and then a report and have it open for that specific department. The code works but it pops up the "enter the parameter value" dialogue and I have to re-type the department...both strange and tedious to the user. Here is my code Dim reportname If Me!Action = 1 Then reportname = "Rpt_PaperworkIncomplete" If Me!Action = 2 Then reportname = "Rpt_TBD" If Me!Action = 3 Then reportname = "Rpt_TBD" If Me!Action = 4 Then reportname = "Rpt_TBD" If Me!Action = 5 Then reportname = "Rpt_TBD" Dim stLinkCriteria As String stLinkCriteria = "[Position]=" & "" & Me![lkp] & "" DoCmd.OpenReport reportname, acViewPreview, , stLinkCriteria PLEASE HELP Well... since none of us can see your tables, or the report, or its criteria, it's a bit hard to be precise; nor do you indicate where on the form the Department might be found. My crystal ball may be a bit hazy, but I'd suggest changing your code to: Dim reportname As String Dim stLinkCriteria As String Select Case Me!Action Case 1 reportname = "Rpt_PaperworkIncomplete" Case Else reportname = "Rpt_TBD" End Select stLinkCriteria = "[Position] = '" & Me![lkp] & _ "' AND Dept = '" & Me!Dept & "'" DoCmd.OpenReport reportname, acViewPreview, , stLinkCriteria -- John W. Vinson [MVP] |
#3
|
|||
|
|||
Option Group and Combo Box
I don't see in your code where you set the value of "reportname"...
Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "ScubaDee" wrote in message ... Can someone help me out here?? I have a combo box with a list of departments on it...and I have an option group listing the different reports. I want the user to pick a department and then a report and have it open for that specific department. The code works but it pops up the "enter the parameter value" dialogue and I have to re-type the department...both strange and tedious to the user. Here is my code Dim reportname If Me!Action = 1 Then reportname = "Rpt_PaperworkIncomplete" If Me!Action = 2 Then reportname = "Rpt_TBD" If Me!Action = 3 Then reportname = "Rpt_TBD" If Me!Action = 4 Then reportname = "Rpt_TBD" If Me!Action = 5 Then reportname = "Rpt_TBD" Dim stLinkCriteria As String stLinkCriteria = "[Position]=" & "" & Me![lkp] & "" DoCmd.OpenReport reportname, acViewPreview, , stLinkCriteria PLEASE HELP |
Thread Tools | |
Display Modes | |
|
|