G
Guest
Am I using these actions correctly. I am not achieving the correct results.
The main form is "frmEmployeeLabels" . On this form is a command add button
to add a new employee. add button code:
Private Sub cmdAdd_Click()
On Error GoTo Err_cmdAdd_Click
Dim stDocName As String
stDocName = "frmAddEmployees"
DoCmd.OpenForm stDocName, , , , acFormAdd
Exit_cmdAdd_Click:
Exit Sub
Err_cmdAdd_Click:
MsgBox Err.Description
Resume Exit_cmdAdd_Click
End Sub
On this form the "close form button" code is:
Private Sub cmdCloseForm_Click()
On Error GoTo Err_cmdCloseForm_Click
Dim ctlFullName As Control
' Return Control object pointing to a text box.
Set ctlFullName = Forms!frmEmployeelabels!FullName
' Requery source of data for list box.
ctlFullName.Requery
DoCmd.RepaintObject acForm, "frmEmployeelabels"
DoCmd.Close
Exit_cmdCloseForm_Click:
Exit Sub
Err_cmdCloseForm_Click:
MsgBox Err.Description
Resume Exit_cmdCloseForm_Click
End Sub
I am trying to update query list on main "frmEmployeeLabels" after an
employee is add from the add employee form.
New employee added does not appear only after closing and opening the main
form.
Help needed with correct coding.
Thank you.
The main form is "frmEmployeeLabels" . On this form is a command add button
to add a new employee. add button code:
Private Sub cmdAdd_Click()
On Error GoTo Err_cmdAdd_Click
Dim stDocName As String
stDocName = "frmAddEmployees"
DoCmd.OpenForm stDocName, , , , acFormAdd
Exit_cmdAdd_Click:
Exit Sub
Err_cmdAdd_Click:
MsgBox Err.Description
Resume Exit_cmdAdd_Click
End Sub
On this form the "close form button" code is:
Private Sub cmdCloseForm_Click()
On Error GoTo Err_cmdCloseForm_Click
Dim ctlFullName As Control
' Return Control object pointing to a text box.
Set ctlFullName = Forms!frmEmployeelabels!FullName
' Requery source of data for list box.
ctlFullName.Requery
DoCmd.RepaintObject acForm, "frmEmployeelabels"
DoCmd.Close
Exit_cmdCloseForm_Click:
Exit Sub
Err_cmdCloseForm_Click:
MsgBox Err.Description
Resume Exit_cmdCloseForm_Click
End Sub
I am trying to update query list on main "frmEmployeeLabels" after an
employee is add from the add employee form.
New employee added does not appear only after closing and opening the main
form.
Help needed with correct coding.
Thank you.