Hi,
I wonder if someone can help me? I have a database which mainly consists of a data entry form for the users to enter details about telephone calls that they receive in a call centre. The form is made up of a number of fields that are dependent on others, however,
only two these fields are mandatory. On occasions (and it took me some time to replicate the error that the users were experiencing), the error for 'Complete all mandatory fields' (that I have inserted) is thrown up even though all mandatory fields are completed.
When this happens, the user is forced to quit out of the record and to re-enter the data so that it is saved in the backend.
The database structure is set up so that a backend is located on the server and each user has their own copy of the front end. It seems that the error only occurs when users are simultaneously using the database, but the fact that this is happening at all is making the database extremely frustrating for the usesr and myself.
Bleow is the code for the form, hopefully someone may have come across this before and can shed some light on the problem?
Option Compare Database
Private Sub cboDepartment_AfterUpdate()
On Error Resume Next
Select Case cboDepartment.Value
Case "Legal"
cboReasonForError.RowSource = "tblLegalErrorReasons"
Case "Means"
cboReasonForError.RowSource = "tblMeansErrorReasons"
Case "Finance"
cboReasonForError.RowSource = "tblFinanceErrorReasons"
End Select
On Error Resume Next
Select Case cboDepartment.Value
Case "Legal"
cboCategoryOfWork.RowSource = "tblLegalWork"
Case "Means"
cboCategoryOfWork.RowSource = "tblMeansWork"
Case "Finance"
cboCategoryOfWork.RowSource = "tblFinanceWork"
End Select
End Sub
---------------------------------------------
Private Sub Close_Form_Click()
If Me.Dirty Then
DoCmd.RunCommand acCmdUndo
End If
If vbYes = MsgBox("Are you sure you want to exit?", vbQuestion Or vbYesNo, "Exit?") Then
DoCmd.Quit
End If
End Sub
---------------------------------------------
Private Sub Form_AfterInsert()
Me.CallID.SetFocus
MsgBox "Data logged, thank you. Your Call Reference is " & CallID.Text, vbOKOnly, "CST Call Logging"
DoCmd.GoToRecord , , acNewRec
End Sub
---------------------------------------------
Private Sub Form_Current()
On Error Resume Next
Dim strCallerType As String
If IsNull(cboReasonForCall.Value) Then
grpCallerType.Value = Null
End If
strCallerType = DLookup("[CallerType]", "tblCallerReasons", "[CallerReason]='" & cboReasonForCall.Value & "'")
Select Case strCallerType
Case "Client"
grpCallerType.Value = 1
Case "Provider"
grpCallerType.Value = 2
Case "Other Party"
grpCallerType.Value = 3
End Select
cboReasonForCall.RowSource = "Select tblCallerReasons.CallerReason " & _
"FROM tblCallerReasons " & _
"WHERE tblCallerReasons.CallerType = '" & strCallerType & "' " & _
"ORDER BY tblCallerReasons.CallerReason;"
End Sub
---------------------------------------------
Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acNewRec
Dim blRet As Boolean
blRet = MouseWheelOFF(False)
End Sub
---------------------------------------------
Private Sub Submit_Click()
On Error GoTo Err_Submit_Click
If Me.Dirty Then
DoCmd.GoToRecord , , acNewRec
End If
Exit_Submit_Click:
Exit Sub
If Err.Number = 2105 Then
Err.Description = MsgBox("Please complete all mandatory fields", vbOKOnly, "CST Call Logging")
Else
MsgBox Err.Description
End If
Resume Exit_Submit_Click
End Sub
---------------------------------------------
Private Sub Form_BeforeInsert(Cancel As Integer)
Me.txtUserID = lngUserID
Me!CallID = Nz(DMax("[CallID]", "[tblCallLog]"), 0) + 1
End Sub
---------------------------------------------
Private Sub Cancel_Click()
On Error GoTo Err_Cancel_Click
If Me.Dirty Then
DoCmd.RunCommand acCmdUndo
End If
Exit_Cancel_Click:
Exit Sub
Err_Cancel_Click:
If Err.Number = 2046 Then
Err.Description = MsgBox("Nothing to undo", vbOKOnly, "CST Call Logging")
Else
MsgBox Err.Description
End If
Resume Exit_Cancel_Click
End Sub
---------------------------------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.cboReasonForCall = "Other (Enter details below)" And IsNull(Me.Other) Then
Me.Other.SetFocus
Cancel = True
End If
If Me.cboReasonForError = "Other (Enter details below)" And IsNull(Me.Other) Then
Me.Other.SetFocus
Cancel = True
End If
End Sub
---------------------------------------------
Private Sub grpCallerType_AfterUpdate()
On Error Resume Next
Dim strCallerType As String
Select Case grpCallerType.Value
Case 1
strCallerType = "Client"
Case 2
strCallerType = "Provider"
Case 3
strCallerType = "Other Party"
End Select
cboReasonForCall.RowSource = "Select tblCallerReasons.CallerReason " & _
"FROM tblCallerReasons " & _
"WHERE tblCallerReasons.CallerType = '" & strCallerType & "' " & _
"ORDER BY tblCallerReasons.CallerReason;"
End Sub
---------------------------------------------
Thanks
Andy