Unknown error message

S

Scott

I have a before update event procedure to check if the new data has been
entered or not as below:-

Private Sub txtSupplier_BeforeUpdate(Cancel As Integer)



If DCount("*", "tblSupplier", "[Supplier] = '" & Me.txtSupplier & "'") >
0 Then



MsgBox "This Supplier has been registered before!"

Cancel = True



End If



End Sub



If I enter a repeated data into the field, the reminder box appears. I
click OK button and it comes up another box as below:-



The value in the field or record violates the validation rule for the record
or field.



For example, you may have changed a validation rule without verifying
whether the existing data matches the new validation rule.

Click Undo on the Edit menu to restore the previous value, or enter a new
value that meets the validation rule for the field.



As I have my error message, how can I avoid this one.



Thanks,



Scott
 
B

Bob Hairgrove

I have a before update event procedure to check if the new data has been
entered or not as below:-

Private Sub txtSupplier_BeforeUpdate(Cancel As Integer)
If DCount("*", "tblSupplier", "[Supplier] = '" & Me.txtSupplier & "'") >
0 Then
MsgBox "This Supplier has been registered before!"
Cancel = True
End If
End Sub


If I enter a repeated data into the field, the reminder box appears. I
click OK button and it comes up another box as below:-

The value in the field or record violates the validation rule for the record
or field.

For example, you may have changed a validation rule without verifying
whether the existing data matches the new validation rule.

Click Undo on the Edit menu to restore the previous value, or enter a new
value that meets the validation rule for the field.


As I have my error message, how can I avoid this one.

I think you need to put this code in the BeforeInsert event of the
form.
 
G

Guest

Private Sub txtSupplier_BeforeUpdate(Cancel As Integer)

If Not IsNull(DLookup("[Supplier]", "tblSupplier", "[Supplier] = '" & _
Me.txtSupplier & "'")) Then
MsgBox "This Supplier has been registered before!"
Cancel = True
End If
End Sub
 
S

Scott

Bob,

It did not work at all when I put it into the BeforeInsert event of the
form.

Scott

I have a before update event procedure to check if the new data has been
entered or not as below:-

Private Sub txtSupplier_BeforeUpdate(Cancel As Integer)
If DCount("*", "tblSupplier", "[Supplier] = '" & Me.txtSupplier & "'")0 Then
MsgBox "This Supplier has been registered before!"
Cancel = True
End If
End Sub


If I enter a repeated data into the field, the reminder box appears. I
click OK button and it comes up another box as below:-

The value in the field or record violates the validation rule for the
record
or field.

For example, you may have changed a validation rule without verifying
whether the existing data matches the new validation rule.

Click Undo on the Edit menu to restore the previous value, or enter a new
value that meets the validation rule for the field.


As I have my error message, how can I avoid this one.

I think you need to put this code in the BeforeInsert event of the
form.
 
S

Scott

Klatuu,

Thanks for your alterntive code but it produced the same error message.

I just discover that once I change the Allow Zero Length to Yes from No, the
system error box disappears. I am unsure if it causes the issue. Any
idea!!

Scott

Klatuu said:
Private Sub txtSupplier_BeforeUpdate(Cancel As Integer)

If Not IsNull(DLookup("[Supplier]", "tblSupplier", "[Supplier] = '" & _
Me.txtSupplier & "'")) Then
MsgBox "This Supplier has been registered before!"
Cancel = True
End If
End Sub


Scott said:
I have a before update event procedure to check if the new data has been
entered or not as below:-

Private Sub txtSupplier_BeforeUpdate(Cancel As Integer)



If DCount("*", "tblSupplier", "[Supplier] = '" & Me.txtSupplier &
"'") >
0 Then



MsgBox "This Supplier has been registered before!"

Cancel = True



End If



End Sub



If I enter a repeated data into the field, the reminder box appears. I
click OK button and it comes up another box as below:-



The value in the field or record violates the validation rule for the
record
or field.



For example, you may have changed a validation rule without verifying
whether the existing data matches the new validation rule.

Click Undo on the Edit menu to restore the previous value, or enter a new
value that meets the validation rule for the field.



As I have my error message, how can I avoid this one.



Thanks,



Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top