Earl Wolf
asked on
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
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
ASKER
Thanks for the syntax. Should this be placed in the event on click setting in the buttons properties?
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.
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.
Anyway
@ Should this be placed in the event on click setting in the buttons properties?
Yes
@ Should this be placed in the event on click setting in the buttons properties?
Yes
ASKER
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Pat,
Thanks for your feedback. Excellent idea to create the form in DataSheet view. I will insist this is the better approach.
Earl
Thanks for your feedback. Excellent idea to create the form in DataSheet view. I will insist this is the better approach.
Earl
The poster selected this comment as his best option.
Private Sub YourButton_Click()
DoCmd.OpenTable "ListofDetectives -tbl", acViewNormal, acViewNormal, acEdit
End Sub