G
Guest
Hi to All,
I am wondering if it is possible to assign a value to a variable from a SQL
statement. If so, I can I code it so it works, I have tried many ways of
coding it but no success
If I use this one :
Set temp = Rst.Open("SELECT Avril FROM GrossMois WHERE [idbranch] = " & num
& " ") I get the error expected fucnction or variable
If I use this one :
temp = CurrentProject.Connection.Execute _
"SELECT Avril FROM GrossMois WHERE [idbranch] = " & num & " " I get a
syntax error.
My goal is to shrink this line of code:
CurrentProject.Connection.Execute _
"UPDATE BudgetHST SET Avril = (SELECT Avril FROM GrossMois WHERE [idbranch]
= " & num & " + (SELECT Avril FROM GrossMois WHERE [idbranch] = " & num & " *
" & HST & ")) WHERE [IdBranch] = " & num & ""
Thanks
Alain
I am wondering if it is possible to assign a value to a variable from a SQL
statement. If so, I can I code it so it works, I have tried many ways of
coding it but no success
If I use this one :
Set temp = Rst.Open("SELECT Avril FROM GrossMois WHERE [idbranch] = " & num
& " ") I get the error expected fucnction or variable
If I use this one :
temp = CurrentProject.Connection.Execute _
"SELECT Avril FROM GrossMois WHERE [idbranch] = " & num & " " I get a
syntax error.
My goal is to shrink this line of code:
CurrentProject.Connection.Execute _
"UPDATE BudgetHST SET Avril = (SELECT Avril FROM GrossMois WHERE [idbranch]
= " & num & " + (SELECT Avril FROM GrossMois WHERE [idbranch] = " & num & " *
" & HST & ")) WHERE [IdBranch] = " & num & ""
Thanks
Alain