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
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