Conditional updating - 98561

I have the following working updating function which is ok:

CurrentDb.Execute "UPDATE Products SET office = products.grossprice*0.72"

I want to add on a condition depending on the field “code” in the same table
products. But I do no know how to do it.I do not want to use a form but
otherwise is it possible to do it ?
What I want to achieve is the following:

If  Products.code = 10153 or Products.code = 10567 or Products.code =  324555
Then
CurrentDb.Execute "UPDATE Products SET office = products.grossprice*0.72"
Else
CurrentDb.Execute "UPDATE Products SET office = products.grossprice*0.9"

How can I do it with Currentdb.execute command?

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201006/1

0
samotek
6/6/2010 1:21:35 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

0 Replies
1263 Views

Similar Articles

[PageSpeed] 24

Reply:

Similar Artilces:

conditional formatting #73
it works!! huge thanks Jason, I've saved days of work. I discovered each cel needed 2 conditional formats, i.e. I would have had to do over 200 edits regards Mar -- Markathepu ----------------------------------------------------------------------- Markathepub's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=353 View this thread: http://www.excelforum.com/showthread.php?threadid=31386 ...

Use Excel to make an update query to another database table?
I have a spreadsheet in Excel with information on it that I'd like to update to a database table (outside of Excel). I have been using Excel to pull database information in, and now I'd like to use it to write data to the same table. To this point I've just been copying the data into an Access table and creating an update query. Anyway to get Excel to do this?? Many thanks in advance. ...

how to prevent a formula in a summary sheet from automatically updating when a row is addedto the referenced sheet
I have a workbook set up that consists of several sheets and a summary sheet that refers to the third row on every other sheet. The worksheets that are referenced contain dated information that is sorted with the most recent entries entered in row 3 and these are the entries I need to track in the summary sheet. When I insert a new row 3 in these worksheets, the formula in the summary automatically updates to line 4 and I need it to always reference row 3, the newest entry. This should be simple but I cannot find the solution. Any ideas? Thanks, krisp1950 You could use the INDIRECT fun...

Problems with Conditional Formatting
Hello All, This may have been covered by previous topics, but I could not see it. I want to apply 3 different conditional formats to a column where the cells have a formula applied as follows: =IF(Q11>=5,"1",IF(Q11>=4,"2", IF(Q11>=3,"3",IF(Q11>=2,"4",IF(Q11<2,"5"))))), Q being a column where a SUM is calculated. The conditions I want are RED for value >=5, ("1"); ORANGE for value >=4, ("2"); and YELLOW for value >=3, ("3"). When I apply the conditional formatting it only appears to work...

XP3 is still in "automatic updates"
OK, so I procrastinated the install of sp3. Coincidentally I read about the deadline of patches and things on July 13,2010. So I read a post or two about where one can read and go update on the web xp3. I glanced at a few of the support pages, when I remembered that Its probably already download and have had it 'sitting' ready to install for a while; in my automatic updates. I am relieved due to the size of this update. So, can I assume that Windows did download this and all I have to do is click install and no further action or investigating on my part is necessary? ...

Conditionally protect cells
Hi, I have an excel workbook that I share with another person in th company. The other person is responsible for entering data in some colums of worksheet (say Column A,B,C,D) and I am responsible to enter data i column's E,F,G,H. The routine is that he enters the data in the Columns A,B,C,D and at later time I update the Columns E,F,G,H. Is there a way that I can lock the Column A,B,C,D if there is data i the columns E,F,G,H. i,e, once I update my columns , he SHOULD NOT be able to update hi columns. They should be locked. Thank -- Rattlesnak -----------------------------------------...

"Today" column not updating
A few times in the past week this has happened: I connect and update my money info online. Money shows me the price change for all of my funds but - for SOME funds only - does NOT update the "Today" column. I was surprised to see that - I thought that the math was done at MY pc - not online. So if I owned 100 shares of XYZ and YESTERDAY it was $20 per share (Money knows that - I update everyday) and today it is $21/share on my screen I see 100 shares $21 per share - it DOES now the new price, but in the TODAY column it does not show $100 as expected - it's blank. So I selecte...

After updating to Office 2007 I'm unable to sync my Pocket PC
After updating from Office 2003 to Office 2007 and adding my exchange server info for email, I have been unable to sync my pocket PC with 2007. I receive the following error message; "cannot synchronize with the Outlook profile you are using because a different profile was previously set up or the profile is password-protected. Please open Outlook using the appropriate profile." Can someone explain to me in English what this means and how to fix it? ...

KB975561 update failing
I am trying to apply the Microsoft update KB975561 to a Windows XP, sp3 pc. I have the automatic updates turned on and when it attempts to install the update it tells me it failed. I don't know where to go to find an error message that may be more relevant. I went to Microsoft's website and downloaded KB975561 and then ran it. I got the message, 'Data Error (cyclic redundancy check). Any help would be appreciated. Thank you, -- Mike Stevens Start here: How to determine whether a computer is compatible with security update 977165 http://support.micro...

How do I get a filter to "UPDATE" the rows selected?
Hey there! I am using Excel 2002 and I have a speadsheet that has prices in it. If I have the filter set to (the filter criteria is much more complex than this though) prices for items that cost >$5.00. Of I change an item to 4.59, it should not be seen. How can I get it to re-update the rows shown, with out releaseing the filter and resetting it? Is there something like refresh.filter or anything like that? Thanks Phil AFAIK you must release and reset but a macro with a worksheet_change event could trigger this for you so that it would happen automatically. -- Don Guillett SalesAid...

Formatting of Excel OLEs in Word is messed up after updating links
I have a Word document with multiple Excel objects pasted and linked to their source files. Every time I try to update any of them, they revert to their original size they had when I first pasted them in, instead of the formatting I applied afterward. I've tried to fix this by editing the links, but the "Preserve formatting after update" box is greyed out on all of them. Is there another way to force these objects NOT to revert to original size every time I update? The way it is now sort of defeats the whole purpose of linking them in the first place. ...

Use different formula to calculation based on conditions
Hi. It's the look of my Excel file: Item 1----Amount Category---Details: ... Item 2----Amount Category---Details: ... Item 3----Amount Category---Details: ... Item 4----Amount Category---Details: ... As you see: - A1 is the item's name; A2 is the price/amount/cost/value of the item - B1 is the category the item belongs to; B2 is the description of the item. Now I would like to do some math which are the following: 1) If the category type is income, add all of them 2) If the category type is one-off expense, add all of them & put a minus sign in front of the value 3) If the cat...

UPDATE OF DATA
I have a problem, one of the stores is sale data that occurred a problem in servant HQ and it did not synchronize the information well, it is to say in the store this the complete data and in HQ this a partial data, since I can make to update in HQ what the store has in UNDER? this happened day 09 of February. Thanks. ...

Updates won't install
These 3 updates have been installed repetedly and each time it shows they have been installedhowever, the updates ready to install icon keeps showing back up saying these updates are ready to install AGAIN! And I have tried turning off spyware and anivirus to install and have restarted several times. Microsoft .NET Framework 3.5 SP1 and .NET Framework 2.0 SP2 Update for Windows Server 2003 and Windows XP x86 (KB982524) Download size: 0 KB , 0 minutes (Downloaded; ready to install) This update addresses a set of known issues of the Microsoft .NET Framework 3.5 Service Pack 1. ...

How to count cells with conditional formatting
Hi! I=B4ve used conditional formatting to color the cell from each column that has de top value. I=B4m using Excel 2007 and I=B4ve created a rule from the category Format only top or bottom ranked values. I=B4ve set it to Top and instead of 10, I=B4ve put 1. This works fine. What I need to do is to count by row how many cells are formatted with this rule. I =B4ve tried to use count.if but I don=B4t know how to tell the function to count only the cells that have conditional formatting because I can=B4t use the same rule that I=B4ve used in conditional formatting. Example A ...

Help using conditional count in form header
Is it possible to have a textbox in the form header to count the number of a conditional textbox in detail section? I get #Error. Thanks ...

Cost Update Method
I'm using POS 2.0. The manual and the help information indicate you should be able to update costs throught the Store Settings > Options > Inventory screen. I do not have the 'Cost update method" options listed on that screen. How can I have my costs updated using the weighted average method? Go to File>Configuration>Inventory, in Store Operations Manager. You should be able to select Weighted Average as your Cost Update Method. "BikeShop" wrote: > I'm using POS 2.0. The manual and the help information indicate you should > be able to up...

Failed Update KB978474 OfficeExcel 2003.ErrorCode0x80070643
2010-03-18 Tomas Nugis Stockholm Sweden.Win Vista Business.Office 2003. Failed update Excel 2003. KB 978474 First of all.Thanks to PA Bear for all your webbsites to solve this update.Professional 1.Info: I"ve found failure code 779 ( HEX code 1913).ERROR code 0x800 70 643 is a generall code for Win Installer problems. 2.I found info in Log files and the Registry Editor key. You can get ALL info there. I check what has happend and all the folders and files. So fare so good. 3. I sent a request to MS Support in Sweden about the failed update KB 978474. 4. I got the answere:Wi...

Updating Departments and Categories
How can I batch update Departments and Categories? I've got a couple thousand records I want to update, and don't want to do it one by one :-) thanks Gary Not sure what you mean by a batch update? What do you need to change? I have some items at this time have no department and no category. I'd like to be able to assign them all to a single department. Man I know what you mean.. There seems to be no inventory wizard function to change a list of items from one dept or category to another. Terrible! "Gary" wrote: > I have some items at this time have no d...

If function using cell format as the condition
I would like to create an "If" logical function formula, where the "true" condition is based on the format of the cell. For instance, if cell b3 is formatting with a fill color, then add that number; if not, then add zero. Can anyone help? That will need VBA, unless the fill colour is derived from conditional formatting (in which case you could impose an equivalent condition). -- David Biddulph "Janie" <Janie@discussions.microsoft.com> wrote in message news:25499DED-25B8-4E7D-8CA2-A22788839E56@microsoft.com... >I would like to create...

Critical update
I am running Office 2008 on my iMac, all legit software. Leopard version 10.5.4. Downloaded (as prompted) critical update today but I then get an error message saying the update cannot be installed on my computer because I do not have Office 2008. Open Word 2008 and go to check for updates - get Critical Update, same problem! Duh! Terry terry irwin <terryirwin@discussions.microsoft.com> wrote: > I am running Office 2008 on my iMac, all legit software. Leopard version > 10.5.4. > > Downloaded (as prompted) critical update today but I then get an error > message sa...

Update Contacts
Hi! Does Outlook Connector synchronizes contacts from Hotmail to MS Outlook only or from MS Outlook to hotmail too? If i change my contacts in MS Outlook 2007, they do not synchronize to hotmail but if i change them in hotmail, it comes to MS Outlook. Thanks! "create_share" <createshare@discussions.microsoft.com> wrote in message news:849B9741-4A21-4F1A-BA61-C364E8027D7C@microsoft.com... > Does Outlook Connector synchronizes contacts from Hotmail to MS Outlook only > or from MS Outlook to hotmail too? > > If i change my contacts in MS Outlook ...

Conditional Formatting #13
I am using a conditional formatting to create a group by using different colour, however, it seems that Excel only allows up to 3 conditions, is there a way to get around this problem without using VBA code since the code needs to be run everytime a value changes ? Thanks ...

Update Table for Obsolescence
I am missing something or have a blind spot about how to do this I have a table (TblAll Products) with all my products in it including a yes/no field to determine if a product is obsolete or not. I have used this years list of all existing products (TblCurrentProducts) to create a query (qryObsoleteProducts) showing any non matched items ie which are in TblAllProducts but not in TblCurrentProducts and are therefore obsolete. I tried to create an Update query from qryObsoleteProducts to set the yes/no flag in TblAllProducts to Yes but am getting an error: Operation must use an updatable quer...

Failed update procedure
Can anyone tell me why the Office 2004 11.2.0 Update is not working on my Mac. It tells me that it can't find any programs to update, but the whole Office suite 2004 is installed. I run 10.4.3. Thanks in advance. Cees Hi Cees- Is it possible that you are already updated to 11.2? Launch one of the Office apps, go to its name in the menu bar & select About... To see what version number displays. Another possibility is if Office is installed for one user on a multi-user system & you are running the updater while logged in as a different user. HTH |:>) On 1/4/06 12:36 PM, i...