Problem with currentdb.execute

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
 
D

Dale Fye

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.
 

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