A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Code to gather information



 
 
Thread Tools Display Modes
  #1  
Old October 10th, 2009, 12:06 AM posted to microsoft.public.access.tablesdbdesign
Fly Boy 5
external usenet poster
 
Posts: 50
Default Code to gather information

I have the following in a query field. Expr1: +[LABOR]+[TRAVCOST]
I need to modify this formula so that if the service is warranty rather than
charge, it would subtract the above plus other fields such as Airfare, auto,
hotel, living expenses, ect.

Thanks for any help you may provide.

Fly Boy 5
  #2  
Old October 10th, 2009, 12:12 AM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Code to gather information

It sounds like you are saying that your table has a field for each category
of cost. If so, that's a spreadsheet, not a relational database!

Instead, consider a table like the following (untested):

tblCost
CostID
Amount
CostCategoryID (this points to another table that lists cost
categories like "labor" and "travel" and ...)
CostDate

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

"Fly Boy 5" wrote in message
...
I have the following in a query field. Expr1: +[LABOR]+[TRAVCOST]
I need to modify this formula so that if the service is warranty rather
than
charge, it would subtract the above plus other fields such as Airfare,
auto,
hotel, living expenses, ect.

Thanks for any help you may provide.

Fly Boy 5



  #3  
Old October 10th, 2009, 11:07 AM posted to microsoft.public.access.tablesdbdesign
Fly Boy 5
external usenet poster
 
Posts: 50
Default Code to gather information

Thanks Jeff,

It's a linked table in Access 2007 called service which contains all hrs,
expenses and revenue. I list the type of service in one field which should
control how the above is calculated. I'm trying to track revenue for each
call but warranty should subtract and produce a negitive figure.
Sorry for not explaining very well and thanks for your efforts.

Fly Boy 5



"Jeff Boyce" wrote:

It sounds like you are saying that your table has a field for each category
of cost. If so, that's a spreadsheet, not a relational database!

Instead, consider a table like the following (untested):

tblCost
CostID
Amount
CostCategoryID (this points to another table that lists cost
categories like "labor" and "travel" and ...)
CostDate

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

"Fly Boy 5" wrote in message
...
I have the following in a query field. Expr1: +[LABOR]+[TRAVCOST]
I need to modify this formula so that if the service is warranty rather
than
charge, it would subtract the above plus other fields such as Airfare,
auto,
hotel, living expenses, ect.

Thanks for any help you may provide.

Fly Boy 5




  #4  
Old October 13th, 2009, 05:51 PM posted to microsoft.public.access.tablesdbdesign
Jackie L
external usenet poster
 
Posts: 148
Default Code to gather information

In your query, put a formula similar to the following
Cost:
IIF([ServiceType]="warranty",(Nz([Labor])+Nz([TravCost]))*-1,Nz([Labor])+Nz([TravCost]))


"Fly Boy 5" wrote:

I have the following in a query field. Expr1: +[LABOR]+[TRAVCOST]
I need to modify this formula so that if the service is warranty rather than
charge, it would subtract the above plus other fields such as Airfare, auto,
hotel, living expenses, ect.

Thanks for any help you may provide.

Fly Boy 5

  #5  
Old October 15th, 2009, 12:42 AM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Code to gather information

I'm still having some trouble visualizing the data/structure.

You posted in the newsgroup dedicated to supporting table (structure) and db
design ... would you please post a description of your table (see my
previous response for an example)?

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or psuedocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.


"Fly Boy 5" wrote in message
...
Thanks Jeff,

It's a linked table in Access 2007 called service which contains all hrs,
expenses and revenue. I list the type of service in one field which
should
control how the above is calculated. I'm trying to track revenue for each
call but warranty should subtract and produce a negitive figure.
Sorry for not explaining very well and thanks for your efforts.

Fly Boy 5



"Jeff Boyce" wrote:

It sounds like you are saying that your table has a field for each
category
of cost. If so, that's a spreadsheet, not a relational database!

Instead, consider a table like the following (untested):

tblCost
CostID
Amount
CostCategoryID (this points to another table that lists cost
categories like "labor" and "travel" and ...)
CostDate

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

"Fly Boy 5" wrote in message
...
I have the following in a query field. Expr1: +[LABOR]+[TRAVCOST]
I need to modify this formula so that if the service is warranty rather
than
charge, it would subtract the above plus other fields such as Airfare,
auto,
hotel, living expenses, ect.

Thanks for any help you may provide.

Fly Boy 5






 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:23 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.