Hi,
I have a table called 'Drawings register' that stores the names of technical drawings, the drawing numbers and their revision numbers.
The idea is that the user clicks on the Add new drawing button on the form, enters the drawing number in the first text box and the revision number in the second text box. Then what I would like is to check if that drawing with that revision aleady exists.
I finally got the code working so that it checks if a drawing number with a particular revision number exists but now I want to jump to that record if it does exist. Otherwise the user continues to add a new drawing.
How do I jump to a specific record in VBA? Is this possible to do in VBA or is there a better way of doing it?
I have a table called 'Drawings register' that stores the names of technical drawings, the drawing numbers and their revision numbers.
The idea is that the user clicks on the Add new drawing button on the form, enters the drawing number in the first text box and the revision number in the second text box. Then what I would like is to check if that drawing with that revision aleady exists.
I finally got the code working so that it checks if a drawing number with a particular revision number exists but now I want to jump to that record if it does exist. Otherwise the user continues to add a new drawing.
How do I jump to a specific record in VBA? Is this possible to do in VBA or is there a better way of doing it?
Code:
Dim drawingNum As Variant
'checks if drawing num and revision number entered in the form already exists in the drawings table
drawingNum = DLookup("[Drawing num]", "Drawings register", "[Drawing num]=Forms!frmAddDrawings![txtDrawing] And [Rev]=Forms!frmAddDrawings![txtRev]")
If Not IsNull(drawingNum) Then
Beep
MsgBox "That drawing number and revision already exists", vbOKOnly, "Duplicate Value"
Cancel = True
End If