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
|
|||
|
|||
Can a button set the form's table/query source?
To put it simply, I have too many forms. There are about 10 forms all the
same but feeding from a different query. There are many fields in it but only 1 field being queried and that is called Scheme. Is it possible to have 1 unbound form and set the source query from code on a button on another form. The flow would be like on a Menu and the user clicks the button for Scheme X and that opend the unbound form and sets the source query to qrySchemeX. And the same if the user click the button for Scheme Y and gets the form based on qrySchemeY. I considered using form filters and having the user just click the radio button atop the page but that was confusing for them. They wanted it clear that it was this Scheme only. Any suggestions appreciated. JBowler |
#2
|
|||
|
|||
Can a button set the form's table/query source?
Yes. You can change the recordsource or sourceobject properties of the
current, subform, or other open form at any time that the controls on that form don't have focus. Pushing the button on 1 form, only to change a second form may be even more confusing though, so I'd suggest using a subform and changing either it's sourceobject (you'll need to maintain the forms) or it's recordsource (easier if all the fields are the same, but doable even if they aren't). The code is: Forms!FormName.RecordSource = "" Between the quotes use a SQL string, or table name, or query name. -- Arvin Meyer, MCP, MVP Microsoft Access Free Access downloads: http://www.datastrat.com http://www.mvps.org/access "JBowler" wrote in message ... To put it simply, I have too many forms. There are about 10 forms all the same but feeding from a different query. There are many fields in it but only 1 field being queried and that is called Scheme. Is it possible to have 1 unbound form and set the source query from code on a button on another form. The flow would be like on a Menu and the user clicks the button for Scheme X and that opend the unbound form and sets the source query to qrySchemeX. And the same if the user click the button for Scheme Y and gets the form based on qrySchemeY. I considered using form filters and having the user just click the radio button atop the page but that was confusing for them. They wanted it clear that it was this Scheme only. Any suggestions appreciated. JBowler |
#3
|
|||
|
|||
Can a button set the form's table/query source?
Thanks. That did exactly what was needed. My Forms just reduced by 9!!
Appreciated. JBowler "Arvin Meyer" wrote in message ... Yes. You can change the recordsource or sourceobject properties of the current, subform, or other open form at any time that the controls on that form don't have focus. Pushing the button on 1 form, only to change a second form may be even more confusing though, so I'd suggest using a subform and changing either it's sourceobject (you'll need to maintain the forms) or it's recordsource (easier if all the fields are the same, but doable even if they aren't). The code is: Forms!FormName.RecordSource = "" Between the quotes use a SQL string, or table name, or query name. -- Arvin Meyer, MCP, MVP Microsoft Access Free Access downloads: http://www.datastrat.com http://www.mvps.org/access "JBowler" wrote in message ... To put it simply, I have too many forms. There are about 10 forms all the same but feeding from a different query. There are many fields in it but only 1 field being queried and that is called Scheme. Is it possible to have 1 unbound form and set the source query from code on a button on another form. The flow would be like on a Menu and the user clicks the button for Scheme X and that opend the unbound form and sets the source query to qrySchemeX. And the same if the user click the button for Scheme Y and gets the form based on qrySchemeY. I considered using form filters and having the user just click the radio button atop the page but that was confusing for them. They wanted it clear that it was this Scheme only. Any suggestions appreciated. JBowler |
Thread Tools | |
Display Modes | |
|
|