Hi again.
I have a form that has a cutomer name and information on it.
there can be many invoice numbers associated with the customer
I have a button that when I select (new RO for this customer) Access opens a new blank form. as soon as I type in any box the rest of the form is filled in with the customers name car and so on
here is the problem
If I type a duplicate Ro Number, (the Ro number comes from the fron counter of the buisness.) access will just delete the whole Ro
I have tried the DLookup function, but am unable to search from an unopen database or Query for a duplicate value.
I use this code in a different form to check to see if I have a duplicate license number.
I have tried to modify it to check for a dluplicate RO number, no luck.
Forms:
open Diagnostics (show all records)
Open Diagnostics (showing only the newly created record) Query to only show only "in progress RO's"
Table:
DiagnosticTabel [RoNumber] set as no duplicates
Private Sub License_BeforeUpdate(Cancel As Integer)
Dim x As Variant
x = DLookup("[License]", "CustomerTable", "[License]= '" & Forms!CustomerTable!License & "'")
On Error GoTo License_Err
If Not IsNull(x) Then
Beep
MsgBox "That License Number already exists, Duplicate License Are Ok, But not VIN numbers", vbOKOnly, "Duplicate Value"
Cancel = False
End If
I just modified the above statements to try to get it to lookup up the Ro, I can get it to see the new and current Ronumber but not search the database.
I just need a message to say "hay stupid that RO already exists", before I type 20 minutes of stuff that just goes away if I have typed in the wrong RONumber.
David