I have a main form with a command button. This button opens a small pop-up form where I can add building information for a new building.
I enter info on the pop-up form and then close it to return to the main form. I want the newly added building information to be available so that I can capture the rest of the information for that building on the main form.
This is the code I have (on the save command button on the pop up form), do not get an error, but it still does not work. The only way it works is if I close the main form and open it again; don't want to do this. What am I doing wrong? I am new to VBA.
Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click
Dim BUILDING_NAME As String
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.Requery
DoCmd.OpenForm ("frm_main_data_entry"), acNormal, , , acFormEdit, acWindowNormal, "edit"
DoCmd.Close acForm, "frm_project_building_information"
Exit_cmdSave_Click:
Exit Sub
Err_cmdSave_Click:
MsgBox Err.Description
Resume Exit_cmdSave_Click
End Sub
thanks in advance!
I enter info on the pop-up form and then close it to return to the main form. I want the newly added building information to be available so that I can capture the rest of the information for that building on the main form.
This is the code I have (on the save command button on the pop up form), do not get an error, but it still does not work. The only way it works is if I close the main form and open it again; don't want to do this. What am I doing wrong? I am new to VBA.
Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click
Dim BUILDING_NAME As String
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.Requery
DoCmd.OpenForm ("frm_main_data_entry"), acNormal, , , acFormEdit, acWindowNormal, "edit"
DoCmd.Close acForm, "frm_project_building_information"
Exit_cmdSave_Click:
Exit Sub
Err_cmdSave_Click:
MsgBox Err.Description
Resume Exit_cmdSave_Click
End Sub
thanks in advance!