Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Case Without select case 1

Status
Not open for further replies.

lars7

Technical User
Aug 16, 2005
817
GB
Hi,
Does anyone know why this select case isn't working. Case 1 was working fine untill I added case 2 and now even if I comment out case 2 it still doesn't work. I am getting a "Case Without Select case " message. I have a similar setup with another option group on another form with 5 cases and It works ok.
On Error GoTo Command110_Err
Select Case Me.Frameoptions2
Case 1
If Trim(Forms!frmmain!List4 & List8 & "") <> "" Then
DoCmd.OpenReport "rptmonthly", acViewPreview, "", "[fldmonths]=[Forms]![frmmain]![list4] And [U_Unit_Name]=[Forms]![frmmain]![list8]"
Case 2
If Trim(Forms!frmmain!List125 & List8 & "") <> "" Then
DoCmd.OpenReport "rptweekly", acViewPreview, "", "[dateId]=[Forms]![frmmain]![list125] And [U_Unit_Name]=[Forms]![frmmain]![list8]"
End Select
Command110_Exit:
Exit Sub
Command110_Err:
MsgBox Error$
Resume Command110_Exit
End Sub
 
Yes, you have a bunch of if statements without "end if
 
Thanks Majp,
I know it was something simple but could not see it. I think I need a break.
 
This is a very important tip in debugging, that happens all the time. If you get a message like that or any of the other program flow structures
"for without next"
"if without end if"
"case without select case"
"add new without update"
etc

Often it is not the one the message is referring to, but something before or within that is not closed off.

So if this happens for example with a for next loop, and you see "for" and "next", then check all of the other program flow syntax. You likely have something either before that loop that is not closed off or inside the loop.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top