One form accessing different ?

  • Thread starter Thread starter John Daily
  • Start date Start date
J

John Daily

Can I create one form that can access different queries
depending on what cmd button is pushed?
Example of different cmd buttons:

commercial
medicare
medicaid
blue cross

accessing 1 form - denials workstation

TIA,

John
 
The way I usually do this is have a list box (if I'm just
displaying) or a sub-form for each query, all sharing the
same space and with their .Visible property set to No (or
False). Each command button makes a different list box
visible.

lstMedicare.Visible = True

Hope this helps!

Howard Brody
 
Hi,

You could create a native access table and have a few
different fields: query_name, query_title,
query_category, create_date, etc. You'd populate it with
the different query names in question, which category, a
descriptive title and so on. Then when you click
on "commercial" button, you'd have to code it so that
you're opening the table and pulling all the recs where
query_category = "commercial"... You could then populate
a combobox with the query_title - this way the user can
select a query to run.

Hope all that made sense!

Regards,
Jen
 
Sure, as long as the queries have the same field names it's simple - with
separate command buttons you'd have code like:

Private Sub Command18_Click()
Me.RecordSource = "qryCommercial"
End Sub

Private Sub Command19_Click()
Me.RecordSource = "qryMedicare"
End Sub

It might be better to use toggle buttons in a frame - then your code would
look more like this:

Private Sub Frame20_AfterUpdate()
Select Case Me.Frame20
Case 1
Me.RecordSource = "qryCommercial"
Case 2
Me.RecordSource = "qryMedicare"
End Select
End Sub
 
Thank you Sandra! This will work perfect!
-----Original Message-----
Sure, as long as the queries have the same field names it's simple - with
separate command buttons you'd have code like:

Private Sub Command18_Click()
Me.RecordSource = "qryCommercial"
End Sub

Private Sub Command19_Click()
Me.RecordSource = "qryMedicare"
End Sub

It might be better to use toggle buttons in a frame - then your code would
look more like this:

Private Sub Frame20_AfterUpdate()
Select Case Me.Frame20
Case 1
Me.RecordSource = "qryCommercial"
Case 2
Me.RecordSource = "qryMedicare"
End Select
End Sub


--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.


John said:
Can I create one form that can access different queries
depending on what cmd button is pushed?
Example of different cmd buttons:

commercial
medicare
medicaid
blue cross

accessing 1 form - denials workstation

TIA,

John

.
 
Back
Top