Today's error message is error 2115.
My code below looks to see if a supplier and a delivery reference have already been checked, and if so, brings back the job number in the database.
I then want to code to Cancel what the user was doing and automatically open up that job number, When trying to assign the bookmark, the code gives me Error 2115. "The macro or function set to the beforeupdate or ValidationRule property for this field is preventing the DB from saving the data in the field. "
I assume that this is to do with the data that the operator is entering, so do i just clear the error in the handler ?
Looking in the immediate window, the code is finding the correct job number, but just cannot filter on it.
Any help appreciated.
My code below looks to see if a supplier and a delivery reference have already been checked, and if so, brings back the job number in the database.
I then want to code to Cancel what the user was doing and automatically open up that job number, When trying to assign the bookmark, the code gives me Error 2115. "The macro or function set to the beforeupdate or ValidationRule property for this field is preventing the DB from saving the data in the field. "
I assume that this is to do with the data that the operator is entering, so do i just clear the error in the handler ?
Looking in the immediate window, the code is finding the correct job number, but just cannot filter on it.
Any help appreciated.
Code:
Private Sub CboxSup_Code_BeforeUpdate(Cancel As Integer)
On error goto handler
If Nz(DCount("Delivery_reference", "tblqcnonconformanceEmg", "Delivery_Reference='" & tbReference & "' AND Sup_Code='" & CboxSup_Code & "'"), 0) > 0 Then
JobNo = DLookup("JOb_ID", "tblqcnonconformanceEmg", "Sup_Code='" & CboxSup_Code & "' AND Delivery_Reference='" & tbReference & "'")
If MsgBox("Delivery Reference " & Format(tbReference, "0000000") & " And Supplier Code '" & UCase(CboxSup_Code) & "'" & vbNewLine & vbNewLine & "Have already been Input " & vbNewLine & vbNewLine & "Press ok to go to that original Job to Carry on Inputting!", vbOkay, "Presviously Input") Then
PerformSearch:
Dim rs As Object
Dim lngID As Long
If JobNo > 0 Then
Me.FilterOn = False
Set rs = Me.RecordsetClone
With rs
.FindFirst "[Job_id]=" & JobNo
If .NoMatch Then
MsgBox "Sorry, that Job Number does not exists.", vbExclamation, "Job Number Not Found"
Else
[COLOR="Red"] Me.Bookmark = .Bookmark ' Debug highlights this line[/COLOR]
End If
End With
Set rs = Nothing
End If
DoEvents
End If
End If
Exit Sub
Handler:
Call LogError(Err.Number, Err.Description, "23", tbReference)
Forms!frmnonconformance.Visible = True
Exit Sub
End Sub