Query Select by Group Option

  • Thread starter Thread starter LJG
  • Start date Start date
L

LJG

I have a form with an option box, depending on the option selected I need to
have a different query used for the form, any ideas on how I can do this?

TIA
 
Dear LJG,

I recommend you to do the following:
1. Create a option box.
2. Create all queries.
3. In the On Click event of the option box, insert the the following code.

Dim stQryName As String
If Me!Frame5 = 1 Then 'First Option.
stQryName = "qryDetails"
DoCmd.OpenQuery stQryName, acNormal
ElseIf Me!Frame5 = 2 Then 'Second Option.
stQryName = "qryMonthly"
DoCmd.OpenQuery stQryName, acNormal
End If

Hope this is helpful.
 
Hello,

I have a similiar issue, but I want to avoid having to create tons of
queries if possible. Here is what I wish to achieve:

Create multiple toggle buttons or an option group where when the button is
hit, it pulls up some records (singlely or multiple) from a form/table. I've
been so far creating separate queries and then using the macro Open Query,
but I find this really slow as I've got alot of these I need to create. The
only way I've seen it done so far is through the apply filter macro with an
option group but I think this is only when you are filtering on the form that
is currently open (see Northwind example, for Suppliers).

Am I missing something or is this something I'd need to do in VB? I'd like
to ideally use just a macro...

Thank you,
Sophie
 
Back
Top