Hello,
I currently have a table called "tblPictureIndex" that is referenced on my form in Access. I have a button on my form that is meant to clear out two fields in the table based on a field on the form called "CutCode" (also referenced in the same table). My code is listed below:
The first set of code runs smoothly. On my form the field Pic1 is referenced by a Text Box. However, when Access goes to run the second bit of code, I get Runtime Error 91. The only thing I can think of is that instead of a textbox, PicID1 is referenced by a Combo Box in my form. Does this have anything to do with it or is there something else I am missing? The code specifically stumbles at the second db.Execute.
Thanks for your assistance.
I currently have a table called "tblPictureIndex" that is referenced on my form in Access. I have a button on my form that is meant to clear out two fields in the table based on a field on the form called "CutCode" (also referenced in the same table). My code is listed below:
Code:
Private Sub delPic1_Click()
Dim strUpdate As String
Dim db As DAO.Database
Set db = CurrentDb
strUpdate = "UPDATE tblPictureIndex " & _
"SET tblPictureIndex.Pic1 = NULL " & _
"WHERE tblPictureIndex.CutCode = " & "'" & Me.CutCode & "';"
Debug.Print strUpdate
db.Execute strUpdate, dbFailOnError
Set db = Nothing
strUpdate = "UPDATE tblPictureIndex " & _
"SET tblPictureIndex.PicID1 = NULL " & _
"WHERE tblPictureIndex.CutCode = " & "'" & Me.CutCode & "';"
Debug.Print strUpdate
db.Execute strUpdate, dbFailOnError
Set db = Nothing
End Sub
The first set of code runs smoothly. On my form the field Pic1 is referenced by a Text Box. However, when Access goes to run the second bit of code, I get Runtime Error 91. The only thing I can think of is that instead of a textbox, PicID1 is referenced by a Combo Box in my form. Does this have anything to do with it or is there something else I am missing? The code specifically stumbles at the second db.Execute.
Thanks for your assistance.