Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / March 2007

Tip: Looking for answers? Try searching our database.

Help with Update query in VBA - PLEASE

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nxqviet - 30 Mar 2007 18:33 GMT
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 -
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.