Improving error messages on this generator?

rodvaN

Registered User.
Local time
Today, 11:35
Joined
May 20, 2009
Messages
92
I got this code that generates data from a rank you asign on "Data 1" and "Data 2" fields, it works great except I dont how how to display an error message if you dont put the same letter on Data 2 that Data 1 and viceversa.. and if you use Minus.

--------------------------------
Private Sub Command5_Click()
On Error GoTo Err_Command5_Click

Set db = CurrentDb
Set rs = db.OpenRecordset("Almacenes")
For x = Val(Right(Me!Data1, 3)) To Val(Right(Me!Data2, 3))
rs.AddNew
rs!Almacen = Left(Me!Data1, 1) & String(3 - Len(x), "0") & x
rs.Update
Me.Refresh
Next
Exit_Command5_Click:
Exit Sub

Err_Command5_Click:
MsgBox "Theres an erroron the syntax, try using A001 - A005", , "buhoruS dice:"
End Sub
---------------
 

Users who are viewing this thread

Back
Top Bottom