Simple "Edit Employee Details" Form

1jet

Registered User.
Local time
Today, 23:50
Joined
Sep 15, 2008
Messages
117
Hi all,

My simple "Edit Employee Form" has not been made with the wizard, instead it's been done in design view. This has helped me learn more about how forms work with queries etc...but not enough obviously.

When you select from the combo box (showing employee ID AND name) the employee, the remaining text boxes (Name, Mobile No., Address etc) automatically populate after many hours realising I needed the following query as the control source of the form...

SELECT tblEmployee.* FROM tblEmployee WHERE (((tblEmployee.[Employee ID])=Forms!frmEditEmployee!cboEmployeeID));

I'm stuck now with my cmdSave button. OnDirty it's enabled and OnClick executes a macro that "Saves" to table "tblEmployee", but I get a message that reads "The object 'tblEmployee' isn't open."

I have the feeling it's got something to do with my newbness and inexperience with Access, and the fact that I've drawn up this form in design view instead of using the wizard.

Please help a newbie.
It's free of charge.
Thanks in advance...
 
Start by making the RecordSource of the form: SELECT tblEmployee.* FROM tblEmployee without any limits. Then use the ComboBox wizard to create a ComboBox the will "find a record" or Option #3. Then look at the AfterUpdate event of the ComboBox to see how it was done. The record will automatically be saved whenever it needs to be done.
 
Start by making the RecordSource of the form: SELECT tblEmployee.* FROM tblEmployee without any limits. Then use the ComboBox wizard to create a ComboBox the will "find a record" or Option #3. Then look at the AfterUpdate event of the ComboBox to see how it was done. The record will automatically be saved whenever it needs to be done.

Well the problem with using just SELECT tblEmployee.* FROM tblEmployee is that the rest of the text boxes will not be populated with the employee I select with the combo box. Actually I get an error message too.

I think my mistake is one of the following two...
1. The "save button macro" has the action "save" (object type = "Table", object name = "tblEmployee"). Maybe this isn't the right way to edit then save details?
2. I'm not using a query to save/"update" my fields.

So I'll try the 2nd option.
I'm not too sure with my SQL syntax, but is the following correct?

UPDATE tblEmployee (id, name, number, rate)
SELECT Forms!frmEditEmp!txtID, Forms!frmEditEmp!txtName, Forms!frmEditEmp!txtNumber,
Forms!frmEditEmp!txtRate;

thanks!
 
Did you set the RecordSource of the form as I asked. Did you use the ComboBox wizard as suggested?
 

Users who are viewing this thread

Back
Top Bottom