PeteJohnston
Programmer
I have a query that accepts 3 parameters and should insert a record into a linked table. It doesn't kick up any errors but it doesn't write the record to the table either.
There are no errors when it tries to execute the query. The error structure Err.number shows as zero. The RecordsAffected property of the query definition shows that 1 record has been inserted. I haven't used On Error Resume Next (work of the devil) and as far as I can see it should have inserted the record. It didn't. The query definition is defined as a DAO QueryDef.
If anyone can come up with a solution I will be forever in their debt.
PeteJ
(Contract Code-monkey)
It's amazing how many ways there are to skin a cat
(apologies to the veggies)
Code:
Set qDef = db.QueryDefs("qryInsertChild")
qDef.Parameters("Master ID") = txtID
' Process all of the selected records
sSQL = "Select * From tblGenerated " & _
"Where User = '" & cSystem.WinUserName & "' " & _
"And Selected = True "
Set rst = db.OpenRecordset(sSQL)
If rst.RecordCount > 0 Then
rst.MoveFirst
Do While Not rst.EOF
qDef.Parameters("Due to Run") = rst.Fields("RunDate")
qDef.Parameters("Due to Requestor") = rst.Fields("RequestorDate")
Err.Clear
qDef.Execute dbFailOnError
If Err.Number = 0 Then
ConfirmRequests = ConfirmRequests + qDef.RecordsAffected
End If
rst.MoveNext
Loop
End If
There are no errors when it tries to execute the query. The error structure Err.number shows as zero. The RecordsAffected property of the query definition shows that 1 record has been inserted. I haven't used On Error Resume Next (work of the devil) and as far as I can see it should have inserted the record. It didn't. The query definition is defined as a DAO QueryDef.
If anyone can come up with a solution I will be forever in their debt.
PeteJ
(Contract Code-monkey)
It's amazing how many ways there are to skin a cat
(apologies to the veggies)