Thankyou for that, the error message does not appear anymore, But i cannot carry out the function that i was trying to do, maybe my coding is set out wrong. If you look at the coding below, if the cylinder number entered within the inputbox (stringy3) is the same as a cylinder number already in the table it should edit that record, stating that it has been returned and the date of return. However if it a cylinder that is not already in the table then it should just add a new record into the table, confirming the clyinder number and customer etc.
However when i run this code even though the cylinder number within the table matches the cylinder number inputted into Stringy3, it still adds a new record instead of updating the existing record in the table.
Can you see if i am missing anything
Code:
Private Sub Command22_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim StrSQl As String
Dim String3 As Integer
Set db = CurrentDb
Stringy3 = InputBox("Are There Any Returns", "Please Scan/Enter Cylinder Serial Number")
Stringy4 = InputBox("Enter the date you wish to return the cylinder")
Set rs = db.OpenRecordset("SELECT * From tbl_Delupdate Where [Cylinder Number] = " & CDec(Stringy3))
If Stringy3 = [Cylinder Number] Then
rs.Edit
rs![R Status] = Returned
Stringy4 = rs![Date Of R Status]
Else
rs.AddNew
rs![Cylinder Number] = Stringy3
rs!Status = "Returned"
rs!CustNo = Me!CustNo
rs.Update
End If
rs.Close
db.Close