Cmd button to open table?

  • Thread starter Thread starter CW
  • Start date Start date
C

CW

I want a simple cmd button on one of my forms that will open a table in
datasheet view - could somebody help with the code for this please?
Many thanks
CW
 
Yeah, in the click_event write
Docmd.OpenForm FormName, acFormDS
the acFormDS should open your form in datasheet view.
 
the code is:
Docmd.OpenForm YourFormsName, acFormDS

acFormdDs opens forms in datasheet view.
 
Thanks but as I said in my original post it is a table that I want to open,
not a form...
 
CW said:
I want a simple cmd button on one of my forms that will open a table in
datasheet view - could somebody help with the code for this please?


A statement like this will do it:

DoCmd.OpenTable "YourTableName"

However, you should be aware that from a developer's perspective, letting
your users work directly in the tables is a dangerous thing, as you give up
all control over what they do, and you can't provide good user-interface
behavior.
 
Thanks Dirk and I note and fully accept your caution. I'm only going to give
access (no pun intended) to one user whom I know to be very responsible and
careful, otherwise I realise I could be exposing us to all manner of problems.
And if anything does go wrong I will know it was only she or me, so fairly
easy to track down.
Many thanks
CW
 
I get an error - I need to add an argument apparently... how should this be
expressed?
Many thanks
CW
 
CW said:
I get an error - I need to add an argument apparently... how should this be
expressed?


That statement doesn't require any other arguments, though it has some
optional arguments that you don't need to specify. It shouild work as
posted, once you've changed "YourTableName" to the name of your table. The
table name does have to be enclosed in quotes, as shown.

Please post your code and the exact error message you're getting, and
indicate which code statement is flagged as raising the error.
 
Back
Top