Open Table with Button on form

  • Thread starter hubertholz via AccessMonster.com
  • Start date
H

hubertholz via AccessMonster.com

Hello

I would like to place a button that directly opens a particular table after
clicking it.
I am rather new to Access and cannot find the option in the Wizard..

Can someone help me?
 
F

fredg

Hello

I would like to place a button that directly opens a particular table after
clicking it.
I am rather new to Access and cannot find the option in the Wizard..

Can someone help me?

So do you know how to write code?
Add a command button to the form (without using the Wizard).
Display the button's property sheet.
Select the Event tab.
On the Click event line enter
[Event Procedure]
Then click on the little button with the 3 dots that appears on that
line.
The code window will open with the cursor flashing between two already
existing lines of code.
Between those 2 lines write:

DoCmd.OpenTable "TableName"

Change "TableName" to whatever the actual table name is.

Exit and save the changes.

Note... the fact that you can open the table does not mean you should.
Access Tables are for storing of data, not for viewing or
manipulation.
Allowing users to work directly in a Table is like playing with
matches in a hay loft.

You would be better off opening a form bound to the table in Datasheet
View.
Code the button's click event:

DoCmd.OpenForm "FormName", acFormDS
 
A

Arvin Meyer [MVP]

The code would look like:

Private Sub cmdWhatever_Click()
DoCmd.OpenTable "MyTable"
End Sub

where cmdWhatever is the name of the button and MyTable is the name of the
table.
 
L

Linq Adams via AccessMonster.com

I'm more concerned about the statement "cannot find the option in the Wizard"

After placing the button on the form, and the Wizard pops up, do you not have
the option, in the left hand column of ***Form Operations***

If so simply click on this then in the right hand column click on

Open Form
 
H

hubertholz via AccessMonster.com

Hi guys,

Thank you very much for your answers!

You are right, It would be rather stupid to let the user make changes in the
tables. However, I would like to provide him an overview of what is in the
table. Until now, whenever I construct a new form and want to present the
data there, I would have to, you know, flip one side after the other to get
to my desired input. But, I would like to see them all on one list.
I think instead of opening the table, Id prefer this solution..?

hubert
 
B

Bob Quintal

Hi guys,

Thank you very much for your answers!

You are right, It would be rather stupid to let the user make
changes in the tables. However, I would like to provide him an
overview of what is in the table. Until now, whenever I construct
a new form and want to present the data there, I would have to,
you know, flip one side after the other to get to my desired
input. But, I would like to see them all on one list. I think
instead of opening the table, Id prefer this solution..?

hubert

You can make a form appear just like a table datasheet with one click
of the mouse. While in form properties, set the default view to
datasheet. This form should not allow editing the fields.
 
A

Arvin Meyer [MVP]

Using a datasheet has advantages even if you allow editing. You can protect
(lock, disable) some fields. You can not allow deletions. You can create an
audit that keeps track of edits. You cannot do any of that from a table.
 

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

Top