I have tried several things to solve this problem but have failed so far. I don't do lot of Access dev work any more.
I have several fields on a form that are required. I have them set as required and not allowed zero length. The problem is I don't like the system generated error messages. So.......
Do I use a validation rule/text at the table level? Or at the form level? Do I use an OnClose event - what would the code look like. I have tried some code in the onClick event of the Save button see below but the record seems to save anyway. If I get this code to work then do I remove the properties (required, and no zero length) I set at the table level? Thanks a million.
Dim strMessage As String
'Test for Requester length
If Len(Me.Requester) = 0 Then
strMessage = strMessage & vbCrLf & "The Requester must be filled"
'Test for Log Description length
If Len(Me.LogDesc) = 0 Then
strMessage = strMessage & vbCrLf & "The Log Description must be filled"
'Test for Server Name length
If Len(Me.ServerName) = 0 Then
strMessage = strMessage & vbCrLf & "The Server Name must be filled"
'Test for Problem Description length
If Len(Me.ProbDesc) = 0 Then
strMessage = strMessage & vbCrLf & "The Problem Description must be filled"
'Test or error occured
If Len(strMessage) > 0 Then
' the save action you get automatically when inserting a record/save button
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70