Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 17th, 2005, 07:19 AM
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Query Calculations

Hi all, I am new to this forum and have not really designed any advanced databases. I am trying to designa database for our local minor softball league and am having troubles getting a calculation in a query to work right. I have a number of field such as;

H (hits) BB (balls on base) AB (at bats) HBP (hit by pitch)
33 12 62 0

First I am trying to add H + BB + HBP together then devide by AB + BB + HBP

Here is what I came up with;
OBP: Sum(([Batting]![H])+([Batting]![BB])+([Batting]![HBP]))/(([AB])+([Batting]![BB])+([Batting]![HBP]))

I am guessing the problem is with the "[" or "("

Sure would appreciate it if you could help...thanks.

Reply With Quote
  #2 (permalink)  
Old August 17th, 2005, 09:39 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

If you are only taking this data from one table (Batting) then you don't need to state that in your report. I am assuiming it is a control in a report. Perhaps a query. I would use a query and pass that to the report.

OBP:(([H]+[BB]+[HBP])/([AB]+[BB]+[HPB]))

This should work. This also assumes that your table fields are all number fields (integer, long, etc.)

HTH

mmcdonal
Reply With Quote
  #3 (permalink)  
Old August 17th, 2005, 09:56 AM
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, my mistake was even though I just had numbers in all the fields, I had them as text fields, when i switched to number fields it worked fine. Cheers.

Reply With Quote
  #4 (permalink)  
Old August 17th, 2005, 11:59 AM
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Another question if I may, could you please tell me the imput mask to use in order not to show a zero in from of a decimal Ex. I want 0.654 to show as .654
Thanks again

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date Calculations edove ASP.NET 2.0 Basics 0 March 30th, 2007 07:05 AM
simply query calculations!!!!!! thedom Access 0 March 13th, 2007 06:37 PM
DateTime Calculations mrookey C# 4 June 2nd, 2006 06:18 AM
Positioning Calculations rit01 ASP.NET 1.x and 2.0 Application Design 3 February 22nd, 2006 03:10 PM
DateTime calculations sudarshan73 SQL Server 2000 1 March 15th, 2005 03:13 PM



All times are GMT -4. The time now is 02:50 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.