View Single Post
  #2  
Old January 25th, 2010, 09:42 PM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default 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]