UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Update, Access 2016    
 
   
mike60smart
post Feb 14 2020, 11:53 AM
Post#1


UtterAccess VIP
Posts: 14,020
Joined: 6-June 05
From: Dunbar,Scotland


Hi Everyone

I have a Command Button with an On Click Event to update a Control named "Updated"

The Control is Bound to the field table which has a Value List of "Yes";"No"

I am using the following Code but when it runs the Updated Control does not get Updated?

The Code is as Follows:-

CODE
120            strSQL = "UPDATE [tblContractAIAChangeOrders] SET Updated = Yes WHERE ContractChangeOrderID = " & Me.ContractChangeOrderID & " And Updated = No;"
125     Debug.Print strSQL
130   CurrentDb.Execute strSQL, dbFailOnError


The Intermediate window displays the following:-

UPDATE [tblContractAIAChangeOrders] SET Updated = Yes WHERE ContractChangeOrderID = 31 And Updated = No;

How would the code need to be modified to make the update happen?

Any help appreciated.



--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
penfold098
post Feb 14 2020, 12:07 PM
Post#2



Posts: 155
Joined: 5-March 14



What table are you updating? I see no FROM clause.
Go to the top of the page
 
theDBguy
post Feb 14 2020, 12:24 PM
Post#3


UA Moderator
Posts: 78,462
Joined: 19-June 07
From: SunnySandyEggo


Hi Mike. What's wrong with just using?

CODE
Me.Updated = True

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
mike60smart
post Feb 14 2020, 12:49 PM
Post#4


UtterAccess VIP
Posts: 14,020
Joined: 6-June 05
From: Dunbar,Scotland


Hi Guy

It's always the simple thing.

Changed it and now works just fine.

Many thanks

cheers.gif

--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
theDBguy
post Feb 14 2020, 01:15 PM
Post#5


UA Moderator
Posts: 78,462
Joined: 19-June 07
From: SunnySandyEggo


Cool. thumbup.gif

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    7th July 2020 - 08:19 AM