Command Buttons

G

Guest

Using Access 2003

I want to create two command buttons on my switchboard. Both will use the
same underlying table (tblEmployees) as a source.

The one command button (cmdNewEmployee) will be used to enter new employee
info only and it will open the form (frmEmployeeInfo) to a new record.

The other command button (cmdEditEmployee) will be used to edit existing
employee info and it will open the form (frmEmployeeInfo) to all the records
so the user may find the employee record and be able to edit the data.

How can this be done?
Thank you, Karen
 
R

Ron2005

Are you using the generic Access Switchboard

OR

Are you using a "Switchboard"/form of your own design?

Ron
 
J

John Vinson

Using Access 2003

I want to create two command buttons on my switchboard. Both will use the
same underlying table (tblEmployees) as a source.

The one command button (cmdNewEmployee) will be used to enter new employee
info only and it will open the form (frmEmployeeInfo) to a new record.

The other command button (cmdEditEmployee) will be used to edit existing
employee info and it will open the form (frmEmployeeInfo) to all the records
so the user may find the employee record and be able to edit the data.

How can this be done?

Pretty simply. The Command Button Wizard will create the VBA code to
open a form; you just need to edit the code a bit. The wizard code
will look like

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmComplaint"
DoCmd.OpenForm stDocName, , , stLinkCriteria

You just need to add the fourth argument to the OpenForm method (see
the online help for OpenForm for the full gory details):

DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd

or

DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit


John W. Vinson[MVP]
 
G

Guest

Actually, I designed a form from scratch and just went to Tools > Startup and
from the "Display Form/Page" drop-down I just chose the form I wanted to
display when the DB opens. I just refer to it as the switchboard. In this
case I take it that it's not a switchboard.

Thank you, Karen
 
R

Ron2005

Design of the form is fine, but what I was questioning was the use of
the word "switchboard".

What you set up with the Tools>Startup is just that. As long as that is
set, Access will open that form at startup and will open it only one
way.

However under the Tools menu there is also a selection under "database
utilities" called switchboard manager. Given only what you have
indicated so far, I sugggest you go there and create at least three
buttons on what it

It will ask if you want to create a switchboard table - say Yes.
Then on the default switchboard say
Edit
New
Give it a title of something like "Edit existing Records"
and then select open form in edit mode and then select your form
New again
Give it a title of something like "Add New Records" and
then select open form in add mode and then select your form
New again
Give it a title of something like "Leave Access" and then
select "Exit Application"

And Possiblely
go to the Macro area and create a new macro called "Close
Form"
have the only instruction in it be "CloseForm"
and then back to the swtichboard as above
New Again
Give it a title of something like "Close Menu Only" and
then select runmacro and select the closeform macro.

Then go back to the Tools>Startup and chose the Switchboard form.

I hope this is clear.

Ron
 

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