[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 54
  • Last Modified:

Can I open a table to edit using a button in Access 2013?

I would like to open a table to edit (when necessary) using a button. The button will reside on a form that I created for a Main Menu. The name of the table is "ListofDetectives -tbl". I tried this ( docmd.opentable "ListofDetectives -tbl", acviewnormal).

Is this the correct syntax? If so, where would I place it? I do understand that buttons are really for forms, records, reports. I am curious if this can be done.
Thanks
Earl
0
Earl Wolf
Asked:
Earl Wolf
  • 3
  • 2
  • 2
  • +1
1 Solution
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
you must apply the VBA code in YourButton_Click event procedure as the following:

Private Sub YourButton_Click()
      DoCmd.OpenTable "ListofDetectives -tbl", acViewNormal, acViewNormal, acEdit
End Sub
1
 
Earl WolfAuthor Commented:
Thanks for the syntax. Should this be placed in the event on click setting in the buttons properties?
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
Earl,

 Just as a side comment and a cautionary note: this is normally not something you'd do.   Tables should not be worked with directly, but via forms.

 When a table is opened directly, there is no control you can apply over what happens.  

 With Forms and controls, you have properties and methods you can use to ensure data integrity, format, etc.

Jim.
1
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
Anyway
@ Should this be placed in the event on click setting in the buttons properties?
Yes
1
 
Earl WolfAuthor Commented:
Thanks Ferruccio, I appreciate it.

Jim,
I totally agree with you. My client would like to see this done. I've tried talking him out of it, but he's persistent about it. I asked why, his reply was, this is how it was done in their old DB. I told him he could get any data he wants via queries.

This is the reason I am asking.
Earl
Back
Submit

FEATURED POST
0
 
PatHartmanCommented:
If your client wants a form that "looks" like a table, create a form in DataSheet view. He'll never know the difference and you will have the necessary events to control what happens.

Some things are just so wrong that you should refuse to do them.  Of course if you stand up for your principles, you have to be prepared if the client won't budge.  Remind him that he is paying for your expertise.  You don't presume to tell him how to run his business, he shouldn't be telling you yours.
1
 
Earl WolfAuthor Commented:
Pat,
Thanks for your feedback. Excellent idea to create the form in DataSheet view. I will insist this is the better approach.
Earl
0
 
PatHartmanCommented:
The poster selected this comment as his best option.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now