Hi i was reading one of ya'lls thread and thought I might be able to use the first code to do what I need. However, I need it to get the user to click the save command button (i.e. Command165). Once all Errs are corrected then that same save button will save the record. These are the 2 codes I have but I am missing somthing.I don't know much about coding so if you could brake it down for me pleas.
Code:
Private Sub Command165_Click() On Error GoTo Err_Command165_Click DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 Exit_Command165_Click: Exit Sub Err_Command165_Click: MsgBox Err.Description Resume Exit_Command165_Click End Sub __________________________________________________ ___ Private Sub Command165_Click() Dim strError strError = "" If IsNull(Social_Security_Number.Value) Then strError = strError & vbNewLine & Social_Security_Number If IsNull(LastName.Value) Then strError = strError & vbNewLine & LastName If IsNull(FirstName.Value) Then strError = strError & vbNewLine & FirstName If Len(strError) <> 0 Then 'Errors encountered strError = "The following fields are blank:" & vbNewLine & _ strError & vbNewLine _ "Please fill in these fields before submitting" End If End Sub
Comment