Open any table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello All,
I would like to create a button on a form that will open any table, not just
a specific table. Is there a way to do this?

Thanks
 
Hello All,
I would like to create a button on a form that will open any table, not just
a specific table. Is there a way to do this?

Thanks

Well, yes you can, but why would you want to?
Add an unbound combo box to the form.
Set it's Bound Column property to 1.
Set it's RowSource property to:
SELECT MSysObjects.Name FROM MSysObjects WHERE
(((Left([Name],4))<>"MSys") AND ((MSysObjects.Type)=1)) ORDER BY
MSysObjects.Name;

Add a Command button.
Set it's Click event to:
DoCmd.OpenTable ComboName

Select the table from the combo box and click the command button.

Now that I've told you how, I'd like to caution you against allowing
users to view any table. Tables are for storing data, not for viewing.
Allowing a user to view and possibly edit directly in a table is
looking for grief.
 
Hello All,
I would like to create a button on a form that will open any table, not just
a specific table. Is there a way to do this?

Thanks

Do note that users should generally NEVER see raw table datasheets; a
well designed application will have the Forms needed to display the
data in any of the tables. I suspect you may have fallen into the
common trap of "storing data in tablenames" - i.e. having multiple
tables of similar or identical structure, with one table for green
widgets and another table for purple widgets.

I see you've gotten your answer - just make sure that you're asking
the right question!

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top