Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use one form behhind mulitple option buttons

Status
Not open for further replies.

pfunk

Technical User
May 7, 2007
37
GB
i have a form called f_q_t_collection_records which is my main form i am also using duplicate forms created behind command button that use different queries behind each form meaning a different control source. but i am running into a problem when i update f_q_t_collection_records form i also have to copy and paste the format of the form rename it them change the control source on like 14 forms. is there a way the option button can call the same form for different queries so i can just make changes to one form?
 
You can change the record source (not control source) of your form so that a single form can be used for different sets of records. I would question why you have possibly 14 or more different queries?

Duane
Hook'D on Access
MS Access MVP
 
I'd agree with Duane about wondering whether you really need 14 different queries but if you're stuck with that data design then take a look at the OpenArgs property of the form. If you specify OpenArgs when you call the form:
Code:
DoCmd.OpenForm FormName:="myForm", OpenArgs:="Query1"
then you can use code within the form to change its RecordSource as it loads.

Geoff Franklin
 
i have multiple queries behind these forms for status codes,different numbers,Tim zones,etc that we call but every time i change my main form i have copy paste rename it then change the control source to pull from the specific qry on each form to make one change any sugestions????????
 
DoCmd.OpenForm FormName:="myForm", OpenArgs:="Query1" pullud up the form but not the qry behind it
 
I typically don't place any criteria in my queries that are record sources for forms or reports. I don't create multiple similar queries that only differ based on some criteria. "status codes,different numbers,Tim zones" sound like filtering that can dynamically be applied using references to controls on forms.

You would need to provide a few WHERE clauses to get a better idea of what you are attempting to do.

Duane
Hook'D on Access
MS Access MVP
 
then you can use code within the form to change its RecordSource as it loads.

public sub form_open()
if not isnull(me.openArgs) then
me.recordsource = me.openArgs
end if
end sub
 
what would the code look like if i wanted to call f_q_t_collection_records form and the query Q_T_Collection_Records_Phone_Search??
 
DoCmd.OpenForm FormName:="f_q_t_collection_records", OpenArgs:="_T_Collection_Records_Phone_Search
 
DoCmd.OpenForm FormName:="f_q_t_collection_records", OpenArgs:="_T_Collection_Records_Phone_Search"


did not work it opens the f_q_t_collection_records form but notn the qry behind it???
 
How are ya pfunk . . .

Do you have [blue]MajP's[/blue] code [blue]23 Dec 10 12:21[/blue] installed?

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
SURE DO ACEMAN. DONT WORK IT PULLS THE FORM BUT NOT THE OPEN ARGUMENT
 
Hmmmm . . .

You show:
Code:
[blue][highlight]Q[/highlight]_T_Collection_Records_Phone_Search
[highlight]_[/highlight]T_Collection_Records_Phone_Search[/blue]
Which is it?

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
aceman Q_T_Collection_Records_Phone_Search
 
pfunk . . .

We need to see some code in order to help you better.
pfunk said:
[blue] ... i am also using duplicate forms [purple]created behind command button[/purple] that use different queries behind each form ...[/blue]
Post the code behind this button.

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
aceman here is the code behind my phone search option button. i want it to pull the same form F_Q_T_Collection_Records but use the qry behind F_Q_T_Collection_Records_Phone_Search got me?



Private Sub HPHONE_SEARCH_Click()
On Error GoTo Err_HPHONE_SEARCH_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_Q_T_Collection_Records_Phone_Search"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_HPHONE_SEARCH_Click:
Exit Sub

Err_HPHONE_SEARCH_Click:
MsgBox Err.Description
Resume Exit_HPHONE_SEARCH_Click

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top