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  

Select Data Source Based On Outcome Of



 
 
Thread Tools Display Modes
  #1  
Old February 4th, 2010, 10:20 PM posted to microsoft.public.access.forms
Chai
external usenet poster
 
Posts: 35
Default Select Data Source Based On Outcome Of

I have a form that does not have a record source assigned to it. In the form
I have a combo box, and, after selecting something in the combo box I want
the form to be connected to a table or query. Don't know if this is
possible.

Chai
  #2  
Old February 4th, 2010, 10:37 PM posted to microsoft.public.access.forms
PieterLinden via AccessMonster.com
external usenet poster
 
Posts: 307
Default Select Data Source Based On Outcome Of

set the form's recordsource in the AfterUpdate event of the combo box

Chai wrote:
I have a form that does not have a record source assigned to it. In the form
I have a combo box, and, after selecting something in the combo box I want
the form to be connected to a table or query. Don't know if this is
possible.

Chai


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201002/1

  #3  
Old February 4th, 2010, 10:42 PM posted to microsoft.public.access.forms
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Select Data Source Based On Outcome Of

Here one way but all sources must have same fields or be able to be displayed
by a set of generic field aliases.

Base the form on a union query that uses a control (combo with 2 columns)
for criteria to determine which portion of the union query will have any
records to output.
SELECT tbl1.SomeName AS T_Name, tbl1.Name_X AS U_Name, tbl1.Name_Y AS V_Name
FROM tbl1
WHERE [Forms]![MyForm]![cbo1] = 1
UNION ALL SELECT tbl2.OtherName AS T_Name, tbl2.Q_Name AS U_Name,
tbl2.N_Name AS V_Name
FROM tbl2
WHERE [Forms]![MyForm]![cbo1] = 2
UNION ALL SELECT tbl3.Other AS T_Name, tbl3.VR_Name AS U_Name, tbl3.CB_Name
AS V_Name
FROM tbl3
WHERE [Forms]![MyForm]![cbo1] = 3;

You will need an AfterUpdate event on combo to refresh the query.

--
Build a little, test a little.


"Chai" wrote:

I have a form that does not have a record source assigned to it. In the form
I have a combo box, and, after selecting something in the combo box I want
the form to be connected to a table or query. Don't know if this is
possible.

Chai

 




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:17 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.