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

Multiple Record Sources for a form

P: 10
I was wondering if it is possible to have multiple record sources for a form without creating queries, and if so how do I go about doing that.
Thanks
Dec 27 '11 #1

✓ answered by Seth Schrock

You can do it without creating a query object that would appear in the object list, however it would still be a query supporting the form. You would do this by typing the SQL code into the row source property of the form.

Why don't you want to use a query?

Share this Question
Share on Google+
5 Replies


Seth Schrock
Expert 2.5K+
P: 2,951
You can do it without creating a query object that would appear in the object list, however it would still be a query supporting the form. You would do this by typing the SQL code into the row source property of the form.

Why don't you want to use a query?
Dec 27 '11 #2

NeoPa
Expert Mod 15k+
P: 31,709
You can do that (as in you can change the record source on the fly), but most people who have such an interest are just looking for the concept of filtering (See Example Filtering on a Form) without knowing it.
Dec 28 '11 #3

Expert 100+
P: 446
Hi rwest,
you must give us more information about what you want to achieve.

What immediately comes to (my) mind is the use of sub-forms. The main form could be base on the table tblSalesOrders while the Customer details could be based on the tblCustomers table; Sales Order details on the tblSalesOrderDetails table etc. Is that the sort of thing you are thinking of?

To achieve this you start by building separate forms for each table then embed one form within the other. (there is a tool on the tool-bar to add a sub-form/sub-report controls.)

Having said that, you should get into the habit of basing you forms on queries not tables.
S7
Dec 28 '11 #4

P: 10
Would you have an example of the SQL code? The main form's record source is from a table called customers and I want the sub form's record source to be from the tables orders and types. I have a connection between customers and orders, and between orders and types but not between customers and orders. This is why I want 2 record sources for the subform of orders and types. If there is another way I can do this that would be great too.
Dec 28 '11 #5

Seth Schrock
Expert 2.5K+
P: 2,951
If you don't know SQL code, your best bet is to create a query in design view (it is much easier this way for new people). Just include the Customers, Types, and Orders tables and then select the fields that you want out of each. The query will view the relationship and be able to pull the related records and put them together. You can then base the form on that query. The query does the work of combining muliple tables for the form.

I don't have enough information to even guess at what the SQL code that you would need. The basic form of SQL code is:
Expand|Select|Wrap|Line Numbers
  1. SELECT ___
  2. FROM___
  3. WHERE ___ (optional)
The following website will help you learn SQL if you want. SQL tutorial

If you really don't want to have a query object as the source (I can't think why), then take the query that you created in the instructions above and then change to SQL view, copy the code and then paste it into the row source of the form.
Dec 28 '11 #6

Post your reply

Sign in to post your reply or Sign up for a free account.