Changing the table linked to a form

  • Thread starter Thread starter Jason Walter
  • Start date Start date
J

Jason Walter

How can I change a form to use a different table or query. I can do it
in the SQL view for a query, but I don't see that with the form.

Thanks
Jason
 
How can I change a form to use a different table or query. I can do it
in the SQL view for a query, but I don't see that with the form.

Assuming the alternate table/query contains the same fields that the form
controls are bound to:

**With the form in Design view, on the property sheet, find the "Record Source"
property and select the query/table from the list or enter (or generate, using
the Build [...] button on the right of the Property's field) the SQL statement.

**If using VBA ...

Me.Recordsource = "qryMyQuery"
.... or ...
Me.Recordsource = "MyTableName"
.... or, if another form ...
Forms("MyFormName").Recordsource = "MyTableName"

.... and, if you have a specific SQL statement you want to use in place of an
object name, simply assign that instead:

Forms("MyFormName").Recordsource = _
"SELECT * FROM MyTableName"

Setting the Recordsource property via VBA way will cause the form to
automatically requery, so there is no need to add a line in your code to force
it to.
 
Back
Top