Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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
  #1 (permalink)  
Old July 24th, 2007, 08:39 AM
Friend of Wrox
 
Join Date: Apr 2007
Location: , , .
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default Sum function in Access form

Hi All

Problem with Access VBA code here

A Textbox field [Total] have Control Source like =Sum(([QuantityBtB]+[QuantityStock])*[Price])

when running a form it shows #Error in text field

[QuantityBtB]
[QuantityStock]
[Price]

are values from database which is connected with SQL

Any Idea or suggestion


Thanks


  #2 (permalink)  
Old July 25th, 2007, 11:06 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I am not sure if the problem is with the Sum field, or the summed fields. Where is the #Error? [Total]? [QuantityBtB]? [QuantityStock]?
[Price]? Some or all of these?

Can you see the data anywhere else? Like in a table or query?





mmcdonal
  #3 (permalink)  
Old July 26th, 2007, 04:26 PM
Authorized User
 
Join Date: Apr 2007
Location: , , .
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default

First, I would check to make sure the desired solution works in the query which supplies the form. If you have a data type error it would be very apparent though a query.

Second, are [QuantityBtB],[QuantityStock], etc the names of your text box objects? If they are, then you may want to try referring to the actual recordsource field name. That is, if you truly want a Sum of all of the records.

So, if [QuantityStock] object is supplied by the query field "[QtyInStock]" then refer to the column headings of your query when doing your formula instead of the combo box name. Just make sure your textbox object is located in the correct area of the form.

Coby.





Similar Threads
Thread Thread Starter Forum Replies Last Post
sum function pcase XSLT 2 January 2nd, 2008 05:51 PM
sum() function felixm_jr Reporting Services 1 April 22nd, 2007 01:59 AM
Xpath: sum function gracehanh XSLT 13 September 27th, 2005 09:30 AM
SUM Function jmss66 Classic ASP Basics 17 July 29th, 2003 08:00 AM
Need Help with the Sum Function athanatos XSLT 1 July 22nd, 2003 10:06 AM





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