-
Change record source on a Form via Combobox
How do I change record source on a Form via Combobox? VBA or?
What I have now:
1. The user chooses Form1 from Combobox, Form1 opens with record source to Table1
The user chooses Form2 from Combobox, Form2 opens with record source to Table2
Form1 and Form2 are identical, the only thing that changes is record source
What I am trying to accomplish is:
2. The user chooses A from Combobox then FormX opens and based on what user has chosen
it changes the record source eg. to the Table A. This way I dont have to have a form A, B, C...
-
You could just filter the data from just one table, which makes more sense than having more than one identically structured table.
What you want to do can be done providing the tables have identical field names.
You set the form Recordsource in the Combo "After Update Event Procedure" using
me.recordsource = "tablename"
or
me.recordsource = "queryname"
where tablename is the name of a table and queryname is the name of a query
You will of course need one or more If/then or case statements to decide which record source fits the User's selecton.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules