By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,487 Members | 1,747 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,487 IT Pros & Developers. It's quick & easy.

record source

P: n/a
I have a form that is used for entering data. The problem is I have
several tables, so I need some way to change the form's record source
via combo box.

1. How can I make the combo box look for the tables as selections for
the box, so that the user can choose the right table? I have 4 tables
now, but there will be more in the future.

2. What kind of code do I need for the combo box to change record
source for the form (obviously I need to use RecordSource, but how
does it work when using combo box?)
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Sham, if you have four tables with exactly the same structure, and more
planned, something is wrong.

This data probably belongs all in one table, with an extra field to
distinguish whatever has caused you to use different tables. That will be so
much easier to manage to and to work with than separate tables.

If you are determined to go ahead anyway, it would be possible to use the
After Update event procedure of the combo to reassign the RecordSource for
the form. Assuming the combo's RowSource provides a list of valid table
names:

Private Sub MyCombo_AfterUpdate()
If Not IsNull(Me.MyCombo) Then
Me.RecordSource = Me.MyCombo
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Sham" <sh**@whatthefuck.com> wrote in message
news:aa**************************@posting.google.c om...
I have a form that is used for entering data. The problem is I have
several tables, so I need some way to change the form's record source
via combo box.

1. How can I make the combo box look for the tables as selections for
the box, so that the user can choose the right table? I have 4 tables
now, but there will be more in the future.

2. What kind of code do I need for the combo box to change record
source for the form (obviously I need to use RecordSource, but how
does it work when using combo box?)

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.