Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot delete from specified table with ODBC

Status
Not open for further replies.

datadiva

Technical User
Oct 4, 2002
5
US
Converted Access data to SQL and linked tables via ODBC.
In Access 2000 delete button (code below) runs fine.
Enabled MS-DAO 3.6 in VB References and fixed my user-error not defined problems, but now have 3086 RT Error.
I am sure it is because I need to change something else in the vb code reference, but what???

Note: Will compensate for first correct answer !!!

Here is the code:
----------------------
Private Sub Command194_Click()

Dim dbs As DAO.Database
Set dbs = CurrentDb()
Dim lot
Dim project
Dim candle
lot = Me.nLotNbr
project = Me.nProject
candle = Me![Child103]![nCandleNbr]

Response = MsgBox("Are you sure you want to Delete this Candle and all Observations for it. ", vbYesNo)

If Response = vbYes Then
''' *** CODE BREAKS HERE ***
dbs.Execute ("DELETE * FROM TBLLC WHERE nlotnbr like '" & lot & "' AND nproject = " & project & " And ncandlenbr = " & candle)
dbs.Execute ("DELETE * FROM TBLLCOS WHERE nlotnbr like '" & lot & "' AND nproject = " & project & " And ncandlenbr = " & candle)
dbs.Execute ("DELETE * FROM TBLLCOA WHERE nlotnbr like '" & lot & "' AND nproject = " & project & " And ncandlenbr = " & candle)
Me![Child103].Requery

MsgBox ("Delete Successful")
ElseIf Response = vbNo Then
MsgBox ("Candle NOT Deleted")
End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top