I'm creating a library which when everytime i add new book, i always get the 'Update or CancelUpdate without addnew or edit'.The condition is when the user inputs a new ISBN that is already in the database, the message box will prompt as "That book is already listed!', else if the inputted ISBN is not yet listed in the database, that new book isbn and all its information will be saved, but everytime i hit the save button, that error will generate. Help please.... I am using the Data Control and the MS access as instructed by our prof.
Thanks...
here are the codes i have.
Private Sub cmdSave_Click()
Dim isbn As String
Dim msg As String
dtaAdd.Refresh
isbn = txtisbnadd
Do Until dtaAdd.Recordset.EOF
If dtaAdd.Recordset.Fields("ISBN").Value = isbn Then
MsgBox "That book ISBN is already rented. ", vbOKCancel + vbInformation, "Book already on the database"
Exit Sub
Else
dtaAdd.Recordset.MoveNext
End If
Loop
dtaAdd.Refresh
dtaAdd.Recordset.Update
msg = MsgBox("Data has been saved. ", vbOKOnly + vbInformation, "Saving Successful!")
End Sub
your reply is highly acknowledge... thanks...