When the user clicks the submit button on my form i want a message to popup that says the record has been added. I am not sure how to do this with the code i currently have for the submit button. This is a sample of some of the code.
Private Sub CmdSubmit_Click()
Dim db As Database, sourceset As Recordset
Set db = DBEngine.Workspaces(0).Databases(0)
Set sourceset = db.OpenRecordset("report1"
On Error GoTo error_submit
sourceset.AddNew
sourceset!Employee_Name = Text137.Value
sourceset!Stop1 = Combo0.Value
sourceset!Origin = Combo8.Value
sourceset!Stop2 = Combo2.Value
sourceset!Stop3 = Combo4.Value
sourceset!Stop4 = Combo6.Value
sourceset!Stop1_dist = Text10.Value
sourceset!Stop2_dist = Text13.Value
sourceset!Stop3_dist = Text14.Value
sourceset!Stop4_dist = Text15.Value
sourceset!Datefield = ActiveXCtl22.Value
sourceset.Update
sourceset.AddNew
sourceset!Employee_Name = Text137.Value
sourceset!Datefield = ActiveXCtl65.Value
sourceset!Origin = Combo54.Value
sourceset!Stop1 = Combo46.Value
sourceset!Stop2 = Combo48.Value
sourceset!Stop3 = Combo50.Value
sourceset!Stop4 = Combo52.Value
sourceset!Stop1_dist = Text56.Value
sourceset!Stop2_dist = Text58.Value
sourceset!Stop3_dist = Text59.Value
sourceset!Stop4_dist = Text60.Value
sourceset.Update
Exit Sub
error_submit:
If Err.Number = 3022 Then
MsgBox "This record has already been added"
Else
MsgBox Error
End If
Private Sub CmdSubmit_Click()
Dim db As Database, sourceset As Recordset
Set db = DBEngine.Workspaces(0).Databases(0)
Set sourceset = db.OpenRecordset("report1"
On Error GoTo error_submit
sourceset.AddNew
sourceset!Employee_Name = Text137.Value
sourceset!Stop1 = Combo0.Value
sourceset!Origin = Combo8.Value
sourceset!Stop2 = Combo2.Value
sourceset!Stop3 = Combo4.Value
sourceset!Stop4 = Combo6.Value
sourceset!Stop1_dist = Text10.Value
sourceset!Stop2_dist = Text13.Value
sourceset!Stop3_dist = Text14.Value
sourceset!Stop4_dist = Text15.Value
sourceset!Datefield = ActiveXCtl22.Value
sourceset.Update
sourceset.AddNew
sourceset!Employee_Name = Text137.Value
sourceset!Datefield = ActiveXCtl65.Value
sourceset!Origin = Combo54.Value
sourceset!Stop1 = Combo46.Value
sourceset!Stop2 = Combo48.Value
sourceset!Stop3 = Combo50.Value
sourceset!Stop4 = Combo52.Value
sourceset!Stop1_dist = Text56.Value
sourceset!Stop2_dist = Text58.Value
sourceset!Stop3_dist = Text59.Value
sourceset!Stop4_dist = Text60.Value
sourceset.Update
Exit Sub
error_submit:
If Err.Number = 3022 Then
MsgBox "This record has already been added"
Else
MsgBox Error
End If