different query behind form

  • Thread starter Thread starter Miskacee
  • Start date Start date
M

Miskacee

How do I create a select case? I have only one form but depending upon what
button is selected from the main menu, will determine what query should be
used? I'm assuming it is a select case but I can't figure out how to
document it. I have a main menu, 3 options, high success rate, moderate
success rate, low success rate. Depending upon which one of the three
buttons is selected will determine what query should open as the recordsource
to the form.

Thank you so much.
 
There are a lot of different ways to do this. What is different about your
data that requires you to use different queries in the form? From the way
you describe your options (high, moderate, low) it sounds like you want your
form to show a subset of the same data depending on the option selected. If
this is the case, then you use a WHERE condition in the OpenForm statement

DoCmd.OpenForm "MyForm", acNormal, , "Option='" & MyOption & "'"

If you really need three different datasources, then you could open the
form, then change its recordsource.


Select Case MyOption
Case "High"

DoCmd.OpenForm "MyForm", acNormal
Forms!MyForm.Form.Recordsource = "MyQuery1"
 
Back
Top