I have an inputbox on a form which asks for a cylinder number, the user has to therefore type an cylinder number which they want it to be filled, at the moment the individual can type in any cylinder number, but i would like the cylinder number entered to be validated against the cylinder master table, which is a list of all the cylinders avialable.
I have tried to implement this however even if the cylinder number is the same as the cylinder number within the cylinderMaster table an error still occurs "Run-Time error '3021' No current record".
I have set the recordset to ("tbl_transactionMaster") could this be the fault, would i need to set it to the cylinder master table to???
My COde:
I have tried to implement this however even if the cylinder number is the same as the cylinder number within the cylinderMaster table an error still occurs "Run-Time error '3021' No current record".
I have set the recordset to ("tbl_transactionMaster") could this be the fault, would i need to set it to the cylinder master table to???
My COde:
Code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim StrSQl As String
Dim i As Integer
Dim tringy As Integer
Set db = CurrentDb
Set rs = db.OpenRecordset("tbl_TransactionMaster")
For i = 1 To Quantity
Stringy = InputBox("Do You Wish To Fill A Cylinder For Works Order Number :-" & [Works Order Number] & " Line Number " & [Line Number] & "...", "Please Enter/Scan Cylinder Serial Number")
If Stringy = rs![Cylinder Number] Then
Stringy1 = InputBox("Please Input The Transaction Date, (DD / MM / YY)", "Spec Gas System", Me!Text20 & "'")
Else
MsgBox ("The Cylinder Number entered is not a valid Cylinder Number Please Try Again")
If [Batch Number] = True Then
Stringy2 = InputBox("Please Type in the Type of Batch Number")
End If
If [Expiration Required] = True Then
Stringy3 = InputBox("Please Type in the Type of Expiration Date, (DD / MM / YY)", Me!Text20 & "'")
End If
If Stringy <> "" Then
rs.AddNew
rs![Works Order Number] = Me![Works Order Number]
rs![Line Number] = Me![Line Number]
rs!CustNo = Me!CustNo
rs!ProdNo = Me!ProdNo
rs!Status = "Available To Deliver"
rs![Cylinder Number] = Stringy
rs![Transaction Date] = Stringy1
rs![Batch Number] = Stringy2
rs![Expiration Required] = Stringy3
rs.Update
End If
End If
Next i
rs.close
db.close
End Sub