Problem with currentdb.execute

  • Thread starter Thread starter Laurel
  • Start date Start date
L

Laurel

I have the following code in my unload event. Even though ls_SQL is set to
a value which works OK when copied into the query window, only the first of
these actually updates the tblParameters table. Any idea what's going on
and what I can do about it?

TIA
LAS

If Not IsNull(txtLev1Privs) Then
ls_SQL = "Update tblParameters Set ParamValue = '" & txtLev1Privs &
_
"' Where ParamName = 'Level_1_Privileges'"
Call CurrentDb.Execute(ls_SQL, dbFailOnError)
End If

If Not IsNull(txtLev1Restricts) Then
ls_SQL = "Update tblParameters Set ParamValue = '" &
txtLev1Restricts & _
"' Where ParamName = 'Level_1_Restrictions'"
Call CurrentDb.Execute(ls_SQL, dbFailOnError)
End If

If Not IsNull(txtLev2Privs) Then
ls_SQL = "Update tblParameters Set ParamValue = '" & txtLev2Privs &
_
"' Where ParamName = 'Level_2_Privileges'"
Call CurrentDb.Execute(ls_SQL, dbFailOnError)
End If
 
Laurel,

Try getting rid of the Call portion of each of the lines that implement the
Execute method.

CurrentDb.Execute(ls_SQL, dbFailOnError)

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
Back
Top