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 » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

One Query as datasource??



 
 
Thread Tools Display Modes
  #1  
Old December 22nd, 2009, 02:55 PM posted to microsoft.public.access.queries
hshepardjr
external usenet poster
 
Posts: 7
Default One Query as datasource??

I have three different tables that cannot be combined using a Union query due
to efficiency. I would like to use a form to select the table or query to
use and have one query that I can use as the primary datasource. Is this
possible? If so, how?
  #2  
Old December 22nd, 2009, 03:02 PM posted to microsoft.public.access.queries
vanderghast
external usenet poster
 
Posts: 593
Default One Query as datasource??

Have a form with two (three) subforms, each subform with data from one of
the table. If there is no link between the data, have no parent-child link
(or even have no table for the main form).


Vanderghast, Access MVP


"hshepardjr" wrote in message
...
I have three different tables that cannot be combined using a Union query
due
to efficiency. I would like to use a form to select the table or query to
use and have one query that I can use as the primary datasource. Is this
possible? If so, how?


  #3  
Old December 22nd, 2009, 03:09 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default One Query as datasource??

You could create 3 command buttons on the form. On the On Click event of the
button, put something like below. "ASA" would be the name of a table or
query. You could create 3 queries can call them on the buttons.

Me.RecordSource = "ASA"
DoCmd.RunCommand acCmdRefresh

--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"hshepardjr" wrote:

I have three different tables that cannot be combined using a Union query due
to efficiency. I would like to use a form to select the table or query to
use and have one query that I can use as the primary datasource. Is this
possible? If so, how?

  #4  
Old December 22nd, 2009, 03:12 PM posted to microsoft.public.access.queries
hshepardjr
external usenet poster
 
Posts: 7
Default One Query as datasource??

ok. it sounds like each subform will have their own datasource. How do I
connect the one query to use the appropriate selected subform?

"vanderghast" wrote:

Have a form with two (three) subforms, each subform with data from one of
the table. If there is no link between the data, have no parent-child link
(or even have no table for the main form).


Vanderghast, Access MVP


"hshepardjr" wrote in message
...
I have three different tables that cannot be combined using a Union query
due
to efficiency. I would like to use a form to select the table or query to
use and have one query that I can use as the primary datasource. Is this
possible? If so, how?


  #5  
Old December 22nd, 2009, 03:18 PM posted to microsoft.public.access.queries
vanderghast
external usenet poster
 
Posts: 593
Default One Query as datasource??

Assign the RecordSource, it should be something like:

Me.SubFormControlName.FORM.RecordSource = "querynamehere"



Vanderghast, Access MVP


"hshepardjr" wrote in message
...
ok. it sounds like each subform will have their own datasource. How do I
connect the one query to use the appropriate selected subform?

"vanderghast" wrote:

Have a form with two (three) subforms, each subform with data from one of
the table. If there is no link between the data, have no parent-child
link
(or even have no table for the main form).


Vanderghast, Access MVP


"hshepardjr" wrote in message
...
I have three different tables that cannot be combined using a Union
query
due
to efficiency. I would like to use a form to select the table or query
to
use and have one query that I can use as the primary datasource. Is
this
possible? If so, how?



  #6  
Old December 22nd, 2009, 03:20 PM posted to microsoft.public.access.queries
vanderghast
external usenet poster
 
Posts: 593
Default One Query as datasource??

But I assume each form, used as subform, can also have done it, in design,
so that its controls would be associated to the right fields!

If the table structure is unknown (you don't know in advance the field
names), then you may try to use List Controls rather than sub forms.



Vanderghast, Access MVP




"hshepardjr" wrote in message
...
ok. it sounds like each subform will have their own datasource. How do I
connect the one query to use the appropriate selected subform?

"vanderghast" wrote:

Have a form with two (three) subforms, each subform with data from one of
the table. If there is no link between the data, have no parent-child
link
(or even have no table for the main form).


Vanderghast, Access MVP


"hshepardjr" wrote in message
...
I have three different tables that cannot be combined using a Union
query
due
to efficiency. I would like to use a form to select the table or query
to
use and have one query that I can use as the primary datasource. Is
this
possible? If so, how?



  #7  
Old December 22nd, 2009, 05:24 PM posted to microsoft.public.access.queries
hshepardjr
external usenet poster
 
Posts: 7
Default One Query as datasource??

The table structures are the same for each of the three tables. I'm not
sure I'm following the logic here. So, how do I have one query call one of
the three forms based on a selected criteria? For example, I have tables
called: Tier1, Tier2, or Tier3. If I wanted Query1 to use Tier1, Tier2, or
Tier3 data based on a form selection, how do I have the query call one of the
three tables?

"vanderghast" wrote:

But I assume each form, used as subform, can also have done it, in design,
so that its controls would be associated to the right fields!

If the table structure is unknown (you don't know in advance the field
names), then you may try to use List Controls rather than sub forms.



Vanderghast, Access MVP




"hshepardjr" wrote in message
...
ok. it sounds like each subform will have their own datasource. How do I
connect the one query to use the appropriate selected subform?

"vanderghast" wrote:

Have a form with two (three) subforms, each subform with data from one of
the table. If there is no link between the data, have no parent-child
link
(or even have no table for the main form).


Vanderghast, Access MVP


"hshepardjr" wrote in message
...
I have three different tables that cannot be combined using a Union
query
due
to efficiency. I would like to use a form to select the table or query
to
use and have one query that I can use as the primary datasource. Is
this
possible? If so, how?


  #8  
Old December 23rd, 2009, 10:44 AM posted to microsoft.public.access.queries
vanderghast
external usenet poster
 
Posts: 593
Default One Query as datasource??

Me.SurformControl.FORM.ControlSource = "SELECT * FROM " & WhichTier


where WhichTier is an expression as a string holding the name of the table
to be used. I assumed, in this case, you use a subform control.

If the three tables have the same structure, it would be more common to have
just ONE table and select the required data through a WHERE clause.


Vanderghast, Access MVP


"hshepardjr" wrote in message
...
The table structures are the same for each of the three tables. I'm not
sure I'm following the logic here. So, how do I have one query call one
of
the three forms based on a selected criteria? For example, I have tables
called: Tier1, Tier2, or Tier3. If I wanted Query1 to use Tier1, Tier2,
or
Tier3 data based on a form selection, how do I have the query call one of
the
three tables?

"vanderghast" wrote:

But I assume each form, used as subform, can also have done it, in
design,
so that its controls would be associated to the right fields!

If the table structure is unknown (you don't know in advance the field
names), then you may try to use List Controls rather than sub forms.



Vanderghast, Access MVP




"hshepardjr" wrote in message
...
ok. it sounds like each subform will have their own datasource. How do
I
connect the one query to use the appropriate selected subform?

"vanderghast" wrote:

Have a form with two (three) subforms, each subform with data from one
of
the table. If there is no link between the data, have no parent-child
link
(or even have no table for the main form).


Vanderghast, Access MVP


"hshepardjr" wrote in message
...
I have three different tables that cannot be combined using a Union
query
due
to efficiency. I would like to use a form to select the table or
query
to
use and have one query that I can use as the primary datasource. Is
this
possible? If so, how?



 




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:16 PM.


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