Hi all
i would like to thank Darryl, he helped me a lot
now i have another problem
LeBayNum is the primary key in [tblListedItems]
relates to SeBayNum in tblSold
relationship is one LeBayNUM to many SeBayNUM
duplicate numbers are not allowed, so
i am trying to bypass access error handling with the following
procedure in the before update event of the textbox LeBayNUM
Private Sub LeBayNUM_BeforeUpdate(Cancel As Integer)
On Error GoTo ErrorHandler
Dim Cnn As New ADODB.Connection
Dim Rst As New ADODB.Recordset
Set Rst = New ADODB.Recordset
Dim Response As Integer
If IsNull(Forms![frmlisted_3]![frmllisteditems
subform].Form![LeBayNUM]) Or Forms![frmlisted_3]![frmllisteditems
subform].Form![LeBayNUM] = " " Then
Response = MsgBox("eBay Number Must be Entered!" & vbCrLf & "Do You
Want to Cancel the Entry?", vbYesNo)
If Response = vbNo Then
Cancel = True
GoTo done
Else
Forms![frmlisted_3]![frmllisteditems
subform].Form![LeBayNUM].Undo
Cancel = True
GoTo done
End If
Else
If (Forms![frmlisted_3]![frmllisteditems subform].Form![LeBayNUM]
<> Forms![frmlisted_3]![frmllisteditems
subform].Form![LeBayNUM].OldValue) Or
IsNull(Forms![frmlisted_3]![frmllisteditems
subform].Form![LeBayNUM].OldValue) Then
Cnn.Open CurrentProject.Connection
Rst.Open "Select [LeBayNUM] from TblListedItems", Cnn,
adOpenForwardOnly, adLockOptimistic
If Not Rst.EOF Then
Response = MsgBox("Duplicate eBay Number!" & vbCrLf & "Do You Want
to Cancel The Entry?", vbYesNo)
If Response = vbYes Then
Forms![frmlisted_3]![frmllisteditems subform].Form![LeBayNUM].Undo
End If
End If
Rst.Close
Set Rst = Nothing
End If
End If
GoTo done
ErrorHandler:
MsgBox Err.Description
done:
End Sub
i cant get i to work
this is the error message:
the database has been placed in a state by user 'admin' on machine
'ibm-a2423412' that prevents it from being opened or locked