Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-24-2017, 05:53 PM   #1
luzz
Newly Registered User
 
Join Date: Aug 2017
Posts: 346
Thanks: 79
Thanked 6 Times in 6 Posts
luzz is on a distinguished road
Wink Jump to another dataset when user select from combo box

Hi guys!

I would like to allow user to select a different dataset by using combo box and when user select, the subform will show the dataset that the user selected.
Is this possible?

For example;

User can choose either Data1 or data2 from the combo box, then when user select data 1 the subform will show all the data from data1.

I am using Access 2007-2013 for this

Thankyou.

luzz is offline   Reply With Quote
Old 08-24-2017, 06:02 PM   #2
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,007
Thanks: 64
Thanked 2,550 Times in 2,448 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Jump to another dataset when user select from combo box

You use the source object of the subform to set to different data. You may also elect to have a tab control without the tab visible. Load each subform on each tab. When user select from combo switch page of tab.
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Old 08-24-2017, 07:08 PM   #3
luzz
Newly Registered User
 
Join Date: Aug 2017
Posts: 346
Thanks: 79
Thanked 6 Times in 6 Posts
luzz is on a distinguished road
Re: Jump to another dataset when user select from combo box

Thankyou! I am sorry, i dont quite get what you mean. Can you explain in a much more simple way? Thankyou

luzz is offline   Reply With Quote
Old 08-24-2017, 08:37 PM   #4
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,007
Thanks: 64
Thanked 2,550 Times in 2,448 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Jump to another dataset when user select from combo box

1. if you want to use subform
insert a blank subform control on your form.
on its Property->Data->Source Object,
put the table, query, report or form you want to show.
use the arrow key to select.

but since when the form opens the combo has no value yet
(unless ofcourse you set a value on the Form's Load event),
don't put any Source Object yet on the subform,
making it blank when the form load.
now, on AfterUpdate event of the combobox, you need to
populate the subform with table (table1 or table2 depending):
Code:
Private Sub combo_AfterUpdate()

	'sometimes blank subform is named by access as "Child" + number, ie: Child0

	'Objects are always qualified
	'for table = table.table1
	'for query = query.query1
	'for forms = form.formname

	Me.Child0.SourceObject = "Table." & IIF(Me.combo = "Table1", "Table1", "Table2")
End Sub
2. if you want to use Tab control
(you cannot use tables here or query, only forms and reports)
insert a Tab control on your form.
if there are 2 tabs, right-click on the 1st tab
and add another Page (on right-click menu Insert Page)
click on the second Page, drag your form Table1 (from navigation pane)
and put it on this page.
click on the third Page, drag form Table2 and put to this page.
on Property Sheet->combo box just below it, select the TabCtl (TablCtlxxx)
and on Format->Tab Style: None

now on your combos AfterUpdate Event, switch Pages of TabCtl
Code:
Private Sub combo_AfterUpdate()
	' remember that Pages are zero based meaning Page1 actually is item 0
	Me.TabCtl0 = IIF(Me.combo = "Table1", 1, 2)
End Sub
that is the shortest i can think
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Old 08-24-2017, 11:10 PM   #5
PaulO
Newly Registered User
 
Join Date: Oct 2008
Location: HAMPSHIRE, ENGLAND
Posts: 421
Thanks: 13
Thanked 33 Times in 33 Posts
PaulO is on a distinguished road
Re: Jump to another dataset when user select from combo box

Quote:
Originally Posted by luzz View Post
Thankyou! I am sorry, i dont quite get what you mean. Can you explain in a much more simple way? Thankyou
Are you simply looking to access a sub-set of data in a particular table e.g. Male members of a Tennis club as opposed to Female members

If so just build a single dropdown Combo box displaying just Male or Female options, then after making the required selection take the User to a Form that uses as its Data Source a Query of the Members table that uses the selected value in the Combo box as the Criteria for Member Sex.

Hope this approach helps.
__________________
I used to think I knew a bit about Access till I found this site ... !
PaulO is offline   Reply With Quote
The Following User Says Thank You to PaulO For This Useful Post:
luzz (08-27-2017)
Old 08-25-2017, 12:25 AM   #6
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,007
Thanks: 64
Thanked 2,550 Times in 2,448 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Jump to another dataset when user select from combo box

Or maybe she need to show different info graphic on each subform.
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Old 08-27-2017, 04:50 PM   #7
luzz
Newly Registered User
 
Join Date: Aug 2017
Posts: 346
Thanks: 79
Thanked 6 Times in 6 Posts
luzz is on a distinguished road
Re: Jump to another dataset when user select from combo box

Thankyou for your reply! I want the subform to display two difference table in database.
For instance,
select new po, the new po table will be shown in the subform
select printing po, the printing table will be shown in the subform

luzz is offline   Reply With Quote
Old 08-27-2017, 05:10 PM   #8
AccessBlaster
.
 
Join Date: May 2010
Posts: 1,104
Thanks: 24
Thanked 268 Times in 255 Posts
AccessBlaster has a spectacular aura about AccessBlaster has a spectacular aura about
Re: Jump to another dataset when user select from combo box

Quote:
Re: Jump to another dataset when user select from combo box

It might be easier to simply open a switchboard and chose a new database. When the new database opens you have everything you need, forms, reports etc.
AccessBlaster is offline   Reply With Quote
Old 08-27-2017, 05:12 PM   #9
luzz
Newly Registered User
 
Join Date: Aug 2017
Posts: 346
Thanks: 79
Thanked 6 Times in 6 Posts
luzz is on a distinguished road
Re: Jump to another dataset when user select from combo box

That's sound great. I will try thank you
luzz is offline   Reply With Quote
Old 08-27-2017, 05:48 PM   #10
AccessBlaster
.
 
Join Date: May 2010
Posts: 1,104
Thanks: 24
Thanked 268 Times in 255 Posts
AccessBlaster has a spectacular aura about AccessBlaster has a spectacular aura about
Re: Jump to another dataset when user select from combo box

This is a typical switchboard, you still have to create it and code the buttons. New forms and reports but in the long run it could be less confusing for your users.



Attached Images
File Type: jpg switchboard.JPG (17.9 KB, 95 views)

AccessBlaster is offline   Reply With Quote
The Following User Says Thank You to AccessBlaster For This Useful Post:
luzz (08-27-2017)
Reply

Tags
access 2013 , access form , vba access 2007

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Force user to select one combo before other fraser_lindsay Forms 3 02-01-2009 11:56 PM
Combo box - how to jump to an item in list - in col(1) - not bound col RCurtin Forms 9 01-16-2007 06:53 AM
select with join into a dataset PhilBear VB.NET 3 11-28-2006 02:06 AM
how to use 'select distinct ...' to filter a dataset? c# raybristol General 0 02-07-2006 04:08 PM
Button to jump to index location in combo box. Banaticus Forms 2 02-02-2006 04:09 PM




All times are GMT -8. The time now is 08:28 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World