Update crashes Access except in debug

O

OV

Running Access 2003 on XP, doing a select from a table and passing the
results to this subroutine to update another table. When running in debug
mode, it works. When I stop it an anaylze the update statement, copy and
paste into a new query, it works. Running without debug turned on, Access
crashes (on three different installations of Access).

What I know to be true:
1. the input record set contains records, all fields are non-null
2. the datatypes are correct
3. it crashes on the first record

Any clues?
----
Sub UpdLicenseGrantedOutput(rstOutput As Recordset)

Dim SQL_Upd As String
Dim dbs As Database
Set dbs = CurrentDb

' Enumerate the specified Recordset object.
With rstOutput
Dim rc
Do While Not .EOF And Not .BOF
rc = rc + 1
SQL_Upd = " Update tbllicenseRightsSummary Set licensegranted = "
& .Fields(4) & _
" where tbllicenseRightsSummary.Country = '" & .Fields
(1) & "' " & _
" and companyName = '" & .Fields(0) & "'"
On Error GoTo updLicenseGrantedOutputError
dbs.Execute SQL_Upd, dbFailOnError <------ Access crashes
.MoveNext
Loop
End With
rstOutput.Close
dbs.Close

Exit Sub
updLicenseGrantedOutputError:
MsgBox "updLicenseGrantedOutput: Update failed: " & Err.Description &
vbNewLine & "Sql=" & SQL_Upd

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top