A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Can a button set the form's table/query source?



 
 
Thread Tools Display Modes
  #1  
Old June 2nd, 2004, 11:55 AM
JBowler
external usenet poster
 
Posts: n/a
Default 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  
Old June 2nd, 2004, 12:05 PM
Arvin Meyer
external usenet poster
 
Posts: n/a
Default 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  
Old June 2nd, 2004, 12:20 PM
JBowler
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:12 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.