If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
option button to control form query
Hello all-
I have two identical forms. They only differ by the select statement in their queries. I would like eliminate one of the forms and use a radio button in the footer to choose which query to use. Anyone have any suggestions? It seems pretty simple. I am somewhat new to Access. Thanks for your help. ---ehops |
#2
|
|||
|
|||
option button to control form query
One method is to put both queries in a union query and adding another field
for criteria from the Option Group. Like this -- SELECT [Fcd] AS [Field1], [Ged] AS [Field2], [Mxy] AS [Field3] FROM Table1 WHERE [Forms]![MyChoice]![Frame4] = 1 UNION ALL SELECT [Sam] AS [Field1], [Bill] AS [Field2], [Joe] AS [Field3] FROM Table2 WHERE [Forms]![MyChoice]![Frame4] = 2; -- Build a little, test a little. "ehops" wrote: Hello all- I have two identical forms. They only differ by the select statement in their queries. I would like eliminate one of the forms and use a radio button in the footer to choose which query to use. Anyone have any suggestions? It seems pretty simple. I am somewhat new to Access. Thanks for your help. ---ehops |
#3
|
|||
|
|||
option button to control form query
You can also use VBA code in the After Update event of the Group control to
set the desired query as the record source for your form. Set the record source for your form to which ever query you want to use when the form first opens. Make the first option in the Group control to refer to the recordset from the default query. Set the default value of the Group control to 1. Then in the After Update event of the Group control use code like the following: If Me.NameOfYourGourpControl= 1 Then Me.RecordSource = "NameOfDefaultQuery" Else Me.RecordSource = "NameOfSecondQuery" End If ----- HTH Mr. B http://www.askdoctoraccess.com/ Doctor Access Downloads Page: http://www.askdoctoraccess.com/DownloadPage.htm "ehops" wrote: Hello all- I have two identical forms. They only differ by the select statement in their queries. I would like eliminate one of the forms and use a radio button in the footer to choose which query to use. Anyone have any suggestions? It seems pretty simple. I am somewhat new to Access. Thanks for your help. ---ehops |
#4
|
|||
|
|||
option button to control form query
Mr. B-
Thank you!!! I can't figure out how to rate this, but your reply works perfectly. I am an 'old' programmer from an old 4GL language that has long been shelved. I have long since migrated to the operations world. I am now fooling around with Access to try to make the world better for an outfit that only uses excel. I know enough about db's to be dangerous. Thank you so much for your help!! ---ehops "Mr. B" wrote: You can also use VBA code in the After Update event of the Group control to set the desired query as the record source for your form. Set the record source for your form to which ever query you want to use when the form first opens. Make the first option in the Group control to refer to the recordset from the default query. Set the default value of the Group control to 1. Then in the After Update event of the Group control use code like the following: If Me.NameOfYourGourpControl= 1 Then Me.RecordSource = "NameOfDefaultQuery" Else Me.RecordSource = "NameOfSecondQuery" End If ----- HTH Mr. B http://www.askdoctoraccess.com/ Doctor Access Downloads Page: http://www.askdoctoraccess.com/DownloadPage.htm "ehops" wrote: Hello all- I have two identical forms. They only differ by the select statement in their queries. I would like eliminate one of the forms and use a radio button in the footer to choose which query to use. Anyone have any suggestions? It seems pretty simple. I am somewhat new to Access. Thanks for your help. ---ehops |
Thread Tools | |
Display Modes | |
|
|