473,799 Members | 3,350 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Update Query Issues, Revisited!

I'm trying to update my units in stock within a table. This needs to
be updated whenever a product is sold. The products which are sold are
selected through a combo box on my transaction form.

I have looked into the DSum functions but I can only get the DSum
function to add up numbers from a column, I cannot get the DSum
function to remove items from the stock table based on the value
selected in this combo box, the formula I have at the moment is:

DSum("UnitsInSt ock","Products" )

I am aware that this will look in the Products table and choose the
field UnitsInStock and this should total these values up, but when I
run the query I get a blank field, whereas the field should state to
total number of items in stock.

Also, this is where it gets complicated, hopefully I can explain this
without the use of pictures, I have a form called "Appointmen ts Form"
which has a sub form linked to the form "Products Sold Form" this has
a selection drop down box (from the Products Sold Form) that gets its
information from the Products table and the Product Description field,
this combo box has the name "combo_srv"

I originally thought that a command something like:

[combo_srv.produ cts] or [combo_srv.produ cts."product description"]

This is not working how I would like, so really what I am asking is if
someone selects say "Wella Gel" from the combo box "combo_srv" and
subits the order using the Submit button, I would like the field "Units
In Stock" under "Product" to be updated correctly, it this case to
minus one from the total value in stock.

Please can someone help me with this issue, if you would like any
images or the actual databse please let me know by mailing me.

Regards,

Lee Croucher

Nov 13 '05 #1
3 2322
>the formula I have at the moment is:
DSum("UnitsInSt ock","Products" )


Ola L:
For the easy part: the formula you show is looking for a literal string
value:

DSum("UnitsInSt ock","Products" )

In order to force Access to interpret this as a field reference you
need to place the field name in square brackets:

DSum("[UnitsInStock]","Products ")

For the more complex part, I would recommend that instead of directly
manipulating the InStock value that you instead use a more auditable
transaction based model:

1) when the product is inventoried, the field .OnHandAtInvent ory is
updated.
2) Each order is entered into an order transaction table with the
quantity ordered noted.
3) At any time, you can calculate the quantity on hand by
OnHandAtInvento ry - Sum(OrderQty)

In the Interface, you could implement this by creating a single field
subform whose Form.Recordsour ce property is this calculation. By
asserting a Form.Requery to the sfmOnHand subform after each order,
the calculated quantity on hand would be displayed without manipulating
the validated inventory stored value at all.

King Ron of Chi

Nov 13 '05 #2
Ron,

When I use the command shown below in the query:

DSum("[UnitsInStock]","Products ")

The system allows the query to run, but no information is preset, I get
a blank text inpur box, I am not sure if this is my access or I am
using the command incorrectly.

Please can you assist me with this issue, many thanks in advance

Regards,

Lee Croucher

King Ron wrote:
the formula I have at the moment is:
DSum("UnitsInSt ock","Products" )
Ola L:
For the easy part: the formula you show is looking for a literal

string value:

DSum("UnitsInSt ock","Products" )

In order to force Access to interpret this as a field reference you
need to place the field name in square brackets:

DSum("[UnitsInStock]","Products ")

For the more complex part, I would recommend that instead of directly
manipulating the InStock value that you instead use a more auditable
transaction based model:

1) when the product is inventoried, the field .OnHandAtInvent ory is
updated.
2) Each order is entered into an order transaction table with the
quantity ordered noted.
3) At any time, you can calculate the quantity on hand by
OnHandAtInvento ry - Sum(OrderQty)

In the Interface, you could implement this by creating a single field
subform whose Form.Recordsour ce property is this calculation. By
asserting a Form.Requery to the sfmOnHand subform after each order,
the calculated quantity on hand would be displayed without manipulating the validated inventory stored value at all.

King Ron of Chi


Nov 13 '05 #3
Ron,

When I use the command shown below in the query:

DSum("[UnitsInStock]","Products ")

The system allows the query to run, but no information is preset, I get
a blank text inpur box, I am not sure if this is my access or I am
using the command incorrectly.

Also, I understand the theory about the OnHandatInvento ry process, but
how do I get this query to update the database for my individual
product(s) as this is selected on the main form and needs to be
completed when the save button has been clicked

Please can you assist me with this issue, many thanks in advance

Regards,

Lee Croucher

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
5030
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by cust_no, ded_type_cd, chk_no)
16
3878
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the table, or perhaps bytes, being updated where the engine just decides, screw it, i'll just make a new one. surfed this group and google, but couldn't find anything. the context: we have some java folk who like to parametize/
9
2140
by: James Butler | last post by:
Our setup: Online db: MySQL Inhouse db: MS Access 97 with MySQL tables linked via ODBC Our issue: Almost every field updates successfully, except one. A scenario: Information is written to online db. We run an inhouse query to collect info from online db and update
1
6290
by: md7546 | last post by:
Hi, first time posting to this group, but I have followed advice and examples for several months, so thank you. I work for a small telecommunications company. I have a simple Orders database that has an Orders table to track a sales order, using OrdersID as the PK. I have a related one-to-many table called OrderDetails, with the OrdersID as a FK, which shows all the products sold with that order. Then I have an Update table, in a...
17
1963
by: Peter | last post by:
Anybody know what this is about then? 'Because of legal issues, Microsoft has disabled the functionality in Access 2003 and in Access 2002 that let users change the data in linked tables that point to a range in an Excel workbook. However, when you make changes directly in the Excel workbook, the changes appear in the linked table in Access.' It's here: http://support.microsoft.com/default.aspx?scid=kb;en-us;904953
6
2691
by: FayeC | last post by:
I really need help figuring this out. i have a db with mostly text fields but 2. The user_id field is an autonumber (key) and the user_newsletter is a number (1 and 0) field meaning 1 yes the person wants to receive a newsletter and 0 no, don't want to receive it. Now.....when trying to create an UPDATE statement I am running into problems writing the code for it. I had issues before with missing commas but now that the commas are there...
6
1744
by: Akhenaten | last post by:
Coding apparently leads to blindness! I have an unclosed quote in here and I'm not sure where...... $query="UPDATE table_name set ". "First_Name= \"".$formVars."\",". "Date_Committed= \"".$formVars."\",". "Signed_By= \"".$formVars."\",". "Rep= \"".$formVars."\",". "Aut= \"".$formVars."\",". "Car= \"".$formVars."\",".
0
1702
by: jon | last post by:
Hi there, I'm brand new to Access and may be trying to do too much too soon, but I wanted to get some expert advice on how the best way to go about what I am trying to accomplish would be. I am trying to modify the Microsoft Template at the following address (http://office.microsoft.com/en-us/templates/TC012186931033.aspx?CategoryID=CT101426031033) to work as an issues tracker that imports and updates the issues from a SQL 2005...
5
3244
by: abhilashcashok | last post by:
hi guys, my prblem is that I cannot update sql query against MS ACCESS using C#. Everytime wen i do so, i got an exception (at runtime) as 'UPDATE syntax not correct'. I don find any error in my 'update' syntax. I can successfully run other dbase operations like insertion, deletion & all.; except Updation. But, i can successfully run the same update query in the 'sql query tab' of MS ACCESS, and is executed successfully.
0
10490
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10259
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10238
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7570
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5589
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.