Solved

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

Posted on 2016-09-28
8
23 Views
Last Modified: 2016-10-17
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
Comment
Question by:Earl Wolf
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 41819802
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
 

Author Comment

by:Earl Wolf
ID: 41819845
Thanks for the syntax. Should this be placed in the event on click setting in the buttons properties?
0
 
LVL 57
ID: 41819847
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
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 41819856
Anyway
@ Should this be placed in the event on click setting in the buttons properties?
Yes
1
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:Earl Wolf
ID: 41819884
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
 
LVL 34

Accepted Solution

by:
PatHartman earned 500 total points (awarded by participants)
ID: 41819950
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
 

Author Comment

by:Earl Wolf
ID: 41820031
Pat,
Thanks for your feedback. Excellent idea to create the form in DataSheet view. I will insist this is the better approach.
Earl
0
 
LVL 34

Expert Comment

by:PatHartman
ID: 41846331
The poster selected this comment as his best option.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now