Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 19th, 2004, 06:49 PM
Authorized User
 
Join Date: Apr 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Another Update query

Hi All

I've developed a huge headache over this silly problem.
I have an update query that updates a field from adding 2 listboxes in a form together(=[txtQty1]+[txtQty2]).
For some reason when I try to use an expression in the "Update to" field in the query builder, the calculation doesn't work and only include the one value rather than both added together.
I've also tried to use a hidden textbox on the form that has the controll source set to =[txtQty1]+[txtQty2]. This textbox displays the correct sum of both previous mentioned textboxes added together.
When I use this hidden textbox in my "Update to" field still, the quantity showing in the query is only from one textbox rather than the two added together.

What am I doing wrong?

Cheers / Fred

 
Old May 20th, 2004, 07:42 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Can you post your code?

 
Old May 20th, 2004, 06:23 PM
Authorized User
 
Join Date: Apr 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Hi stu9820
This was the first and easiest variation of the code.
Forms Text2 is where a pallet id is entered.

UPDATE tblWH
SET tblWH.Qty = [Forms]![frmPalletConsolidate]![txtQty1]+[Forms]![frmPalletConsolidate]![txtQty2]
WHERE (((tblWH.Pallet)=[Forms]![frmPalletConsolidate]![Text2]));

 
Old May 20th, 2004, 07:47 PM
Authorized User
 
Join Date: May 2004
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It looks like you might be trying to do math with strings? Have you tried changing the "text" quantities to numbers to add them properly?
 
Old May 20th, 2004, 09:01 PM
Authorized User
 
Join Date: Apr 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, I put in a 3rd textbox with the row sourse set to =[txtQty1]+[txtQty2] and it adds them up fine, but when I put the 3rd textbox in the Update to: field in my update query, all that happens when I run it is that it returns the already existing value for the record I want to update instead of the new value in the 3rd textbox.

I've also set the the textbox property Format to General number.

Any ideas?

Cheers / Fred

 
Old May 21st, 2004, 07:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Have you tried:

UPDATE tblWH
SET tblWH.Qty = Forms.frmPalletConsolidate.Form.txtQty1 +
Forms.frmPalletConsolidate.Form.txtQty2
WHERE (((tblWH.Pallet) = Forms.frmPalletConsolidate.Form.Text2));


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
Update Query Help dalezjc Classic ASP Basics 8 March 18th, 2008 08:49 AM
I solved insert query.now see this Update Query. [email protected] VB.NET 2002/2003 Basics 2 September 21st, 2006 12:48 AM
Update query trab Access 1 May 11th, 2006 03:58 PM
Please Help me about UPDATE query huyremy VB Databases Basics 8 September 29th, 2004 03:45 AM
Update query edcaru Access 3 June 14th, 2004 03:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.