Case statement

D

Dar

Here's my problem. I want to place 10-12 unbound frames on top of each other
and make them invisible when form is open. Along side of them will be 10-12
command buttons associated with each frame which will hold a word document .
Example frame 1 and button one refers to my directions.doc etc.
When a button is clicked I want the appropriate frame to become visible with
the document showing. All other frames become invisible. I think I need a
Case statement, but do not know the correct syntax.
Also, if possible, there is a button that will preview a report which will
show the current visible frame.
I already tried this with 3 If statements on the form and it works, but I
figured it's got to be easier with another type of statement. I have not
figured out how to open the report with the corresponding frame. Whew! Any
help would be welcome. Please be specific.
Thanks
 
T

tina

you've already succeeded with If statements, so you know the basic logic
works. the problem is that a Select Case statement looks a single value.
suggest you replace your multiple command buttons with an option control;
you can use toggle buttons rather than checkboxes or radio buttons in the
option control if you prefer that "look". then refer the Select Case to the
option control, as

Select Case Me!OptionControlName
Case 1
' put here the code to show frame 1, etc.
Case 2
' put here the code to show frame 2, etc.
Case Else
' it never hurts to include a case else, to cover unexpected
scenarios
End Select

read up on the Select Case statement in VBA Help if you're not familiar with
how it works.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top