RecordSource?

hi there

Registered User.
Local time
Today, 02:33
Joined
Sep 5, 2002
Messages
171
is it possible to alter the RecordSource on a form or report while in the design view of the form or report? what i mean is when i create a form with bound controls based on a table using the form wizard and then i realize that i forgot to add a field or two while working thru the wizard and i want to add the field from the underlying RecordSource is it possible to add this field even though it doesn't exist in the list of fields from my toolbar button? also this might be a dumb question, but could someone explain to me why you would want to create a from based on a query. i saw someone create a form based on a AutoLookup query to allow the user to view fields from 2 tables on 1 form, but couldn't you do this by setting the relationships from the tables? thanks for any responses.

have a nice day
 
select the form, go to properties and click on data. in the recordsource, select the table or quey you want to bind to. hope this helps!
 
thanks for the response dbalargin. any insight on my form based on a query question?

thanks again
 
supposedly, the query will return faster than the results derived from tables with relationships.
 
Basing a form on a query will also allow you to have a Record pop up on your form that is specific to a value on your form.

For example..
If you have an unbound combo box on your form that contains a list of clients, you could base the query on the value in that combo box only.

This is done by placing this line in the Criteria section of your query Forms!YourFormName!YourComboBoxName underneath the ClientName Field.

And then, in the after update event of the combo box, type Me.Requery

What this essential does is populates the form will only the information pertaining to the client currently listed in your combo box.

Now your users don't have to scroll through all of the records in your form. They can simply type in "Client XYZ" in the unbound combo box and the information for "Client XYZ" will appear.
 
Forms should ALWAYS be based on queries for several reasons. Two of them being:

A query that joins 2 or more tables is the best way to show columns from multiple tables. Although in some instances you can use DLookup()'s, they are very inefficient.

A query that is bound directly to a table, creates unnecessary network traffic because Access transfers all rows from the table to memory on the client PC. If you are working with small Access tables (a few thousand records), you probably won't experience too many problems but if your tables are larger or they are linked ODBC tables, you are wasting resources. Queries should include selection criteria that limits the number of rows retrieved and also they should select only the columns needed rather than all columns from the table.
 

Users who are viewing this thread

Back
Top Bottom