Two things I would like to do with this vba code:
I got the following code but it doesnt work as intended.
Could someone please help me with this:
Thanks in advance !!
- Update a value from one table and save the ID as DeleteID
- Use the DeleteID in the where clause of a delete query
I got the following code but it doesnt work as intended.
Could someone please help me with this:
Code:
Dim myDb As Database
Dim rst As Recordset
Set myDb = CurrentDb
myDb.Execute ("UPDATE tblSubComponent Set ActionID=NULL WHERE SubComponentPN='" & Me.lstActionSelectPart.Value & "'")
Set rst = myDb.OpenRecordset("SELECT @@Identity as DeleteID")
DeleteID = rst.Fields(0)
myDb.Execute ("DELETE * FROM tblSubComponent WHERE ActionID=" & DeleteID & "")
Set rst = Nothing
Set myDb = Nothing
Thanks in advance !!