The RecordSource property of a form can accept:
- a table name
- a query name
- a SQL statement.
You can change the RecordSource property of the form programmatically. For
example, if the form currently has a RecordSource of:
SELECT Table1.* FROM Table1;
you could do this in the Open event procedure of your form:
Dim strSql As String
strSql = "SELECT Table2.* FROM Table2;"
Me.RecordSource = strSql
That's assuming Table1 and Table2 have identical fields (same names, and
same data types.) Some versions of Access will just crash if a field
suddenly disappears or changes data type.
If you do have several tables with the same fields, you have not built a
relational database. Most likely, those tables should be combined into one
table, with an extra field to indicate the category (i.e. whatever reason
you currentlly have them in different tables.)
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.
"Frank Situmorang" <firstname.lastname@example.org> wrote in message
> When I saw on the addresss sample database, the form Household is uing
> by just mentioning SELECT......
> My question is how can type SELECT then prompt the table to us. I normally
> use grid query, what is the difference using grid query of SQL Query ( is
> SQL that using SELECT....?)
> Many thanks for any idea provided
> H. Frank Situmorang