Hello Everyone,
I have a semi-convoluted bit of code that I am working with and am getting a strange error.
=
Run-Time Error '438'
Object doesn't support this property or method
=
What I am trying to accomplish is that once a category is selected (displaying its name in a textbox), should I go to delete the category, it will prompt me for my approval. Assuming I say yes, it will prepare to remove the category by going to every product entered that is using this current category and changing its value to '25' or uncategorized.
Below in code is a select to find the id of the category, a select/update (which is causing the error to occur, on the line that I will bold/color below) and then delete the row afterwards.
========
Private Sub cmdCatDelete_Click()
Dim value As String
Dim CatName As String
Dim strSQL As String
Dim rsCat As String
Dim CatSQL As String
Dim strUpd As String
CatName = Me.txtCatSelect
value = MsgBox("Are you sure that you want to delete this category? Deleting a category will move all associated products to 'Uncategorized' which cannot be displayed until they have a new category manually added to them.", vbYesNo, "Delete the Selected Category?")
If value = 6 Then
'MsgBox ("Value is yes for delete!")
'
CatSQL = "SELECT ID FROM ProdCat WHERE CatName = '" & [Forms]![Brand Category Configuration]![CatDrop1] & "';"
rs1 = CurrentDb.OpenRecordset(CatSQL)
rsCat = rs1!ID
'
'
strUpd = "SELECT * FROM ProdList WHERE ProdCatID = " & rsCat & ""
rs2 = CurrentDb.OpenRecordset(strUpd)
With rs2
Do While Not .EOF
!ProdCatID = "25"
.Update
.MoveNext
Loop
End With
'
strSQL = "DELETE FROM [ProdCat] WHERE [CatName] = '" & CatName & "'"
CurrentDb.Execute strSQL, dbFailOnError
Me.CatDrop1.Requery
Me.txtCatSelect = ""
Else
'MsgBox ("Value is no for delete!")
End If
End Sub
========
Any help would be appreciated
Thanks