Hi all,
I've been using VBA to call out Update queries, but now I have too
many of them, I think it is better to include the sql in VBA so that i
can save some space and make it easier to understand. I tried many
many times, but don't know how. So i'm starting from scrat now.
Her is my update query:
UPDATE xyzTest SET xyzTest.Price = [Forms]![xyzTestFrm]![txPrice]
WHERE (((xyzTest.ID)=2) AND ((xyzTest.SessionID)="Session1"));
xyzTest is my Table, the one I want to update
xyzTestFrm is my Form, where the txPrice and SessionID text fields are
located
I want to have a button that run this SQL without calling an actual
query
I need this really bad and urgently. PLEASE help. Thank you very much
for your help and Time.
V_
SusanV - 30 Mar 2007 18:41 GMT
You're using double quotes inside your VBA statement - try single quotes
instead. Also, you have to bring the form reference outside the quotes and
concatenate it. Try:
CurrentDB.Execute "UPDATE xyzTest SET xyzTest.Price = " &
[Forms]![xyzTestFrm]![txPrice] & "WHERE (((xyzTest.ID)=2) AND
((xyzTest.SessionID)='Session1'));"

Signature
hth,
SusanV
> Hi all,
>
[quoted text clipped - 18 lines]
>
> V_
nxqviet - 30 Mar 2007 18:57 GMT
Thank you so much, It worked !! I think you saved my life heheh =)
thanks SusanV
> You're using double quotes inside your VBA statement - try single quotes
> instead. Also, you have to bring the form reference outside the quotes and
[quoted text clipped - 32 lines]
>
> - Show quoted text -
SusanV - 30 Mar 2007 19:16 GMT
Glad to help any time
;-D
> Thank you so much, It worked !! I think you saved my life heheh =)
>
[quoted text clipped - 37 lines]
>>
>> - Show quoted text -