473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Arithmatic & lookup columns - weird stuff

The description field looks up values from another table: Description,
ProductCost, DeliverCost, OtherCost & SalePrice.

AfterUpdate of the description field is:
Me!Cost =
Me!Description.Column(1)+Me!Description.Column(2)+ Me!Description.Column (3)
Me!Price = Me!Description.Column(2)

This is supposed to add ProductCost, DeliverCost & OtherCost and input it
into a Cost field. There is a value in all three Cost columns (Product,
Delivery & Other) whether it be a figure or 0, there are no nulls. On some
items it works perfectly, on others it seems to multiply the number by 100
(i.e. Product cost = $24.00, Deliver = 0, Other = 0, Cost becomes $2400.00),
and on others I get an error (Runtime 2113 - The value you entered isn't
valid for this field)

Upon testing some of the data, it appears that:

If ProductCost (Description.Column(1)) is a whole dollar then the amount is
multiplied by 100 but if the amount has cents it is not.

If ProductCost is not a whole dollar amount and there is a non-zero amount
in column2 (DeliveryCost) I get the error message

Any thoughts
Dec 9 '06 #1
10 1502
Are all of your fields that populate the lookup columns currency? Eg
are all the Data Type's the same? And have you set the data type of the
field you are calculating?

Dec 10 '06 #2
Yes, all of the fields in the lookup table and the two fields in the current
table are currency.
"keri" <ke*********@diageo.comwrote in message
news:11*********************@j72g2000cwa.googlegro ups.com...
Are all of your fields that populate the lookup columns currency? Eg
are all the Data Type's the same? And have you set the data type of the
field you are calculating?

Dec 10 '06 #3
On Sat, 09 Dec 2006 23:48:24 GMT, "Jimmy" <no**@none.comwrote:

Try this:
Me.Cost =
Me.Description.Column(1)+Me.Description.Column(2)+ Me.Description.Column
(3)
Me.Price = Me.Description.Column(2)

I'm assuming Description is a 4-column dropdown?

-Tom.

>The description field looks up values from another table: Description,
ProductCost, DeliverCost, OtherCost & SalePrice.

AfterUpdate of the description field is:
Me!Cost =
Me!Description.Column(1)+Me!Description.Column(2) +Me!Description.Column (3)
Me!Price = Me!Description.Column(2)

This is supposed to add ProductCost, DeliverCost & OtherCost and input it
into a Cost field. There is a value in all three Cost columns (Product,
Delivery & Other) whether it be a figure or 0, there are no nulls. On some
items it works perfectly, on others it seems to multiply the number by 100
(i.e. Product cost = $24.00, Deliver = 0, Other = 0, Cost becomes $2400.00),
and on others I get an error (Runtime 2113 - The value you entered isn't
valid for this field)

Upon testing some of the data, it appears that:

If ProductCost (Description.Column(1)) is a whole dollar then the amount is
multiplied by 100 but if the amount has cents it is not.

If ProductCost is not a whole dollar amount and there is a non-zero amount
in column2 (DeliveryCost) I get the error message

Any thoughts
Dec 10 '06 #4
Tried changing ! to . with no help. Here is the row source for Description:

SELECT DISTINCTROW tblExpenseItems.Description, tblExpenseItems.ProductCost,
tblExpenseItems.DeliveryCost, tblExpenseItems.OtherCost,
tblExpenseItems.SalePrice FROM tblExpenseItems;

Bound column is 1, limit to list is No, column count 5

And AfterUpdate code:

Me!Cost = Me.Description.Column(1) + Me.Description.Column(2) +
Me.Description.Column(3)

Do columns start numbering as 0 like tab stops?

"Tom van Stiphout" <no*************@cox.netwrote in message
news:6n********************************@4ax.com...
On Sat, 09 Dec 2006 23:48:24 GMT, "Jimmy" <no**@none.comwrote:

Try this:
Me.Cost =
Me.Description.Column(1)+Me.Description.Column(2)+ Me.Description.Column
(3)
Me.Price = Me.Description.Column(2)

I'm assuming Description is a 4-column dropdown?

-Tom.

Dec 10 '06 #5
It appears that what may be happening is that access is concatenating the
three columns rather than performing a mathematical calculation. I.e, rather
than column1 Added to column2 and so on it is simply meshing the two
together, thus $5.00 AND $1.00 AND $1.00 becomes $511.00 rather than $7.00.
any thoughts on how to fix this?? FWIW, column(0) is Description, a text
field.

"Jimmy" <no**@none.comwrote in message
news:Os*******************@fe01.news.easynews.com. ..
Tried changing ! to . with no help. Here is the row source for
Description:

SELECT DISTINCTROW tblExpenseItems.Description,
tblExpenseItems.ProductCost, tblExpenseItems.DeliveryCost,
tblExpenseItems.OtherCost, tblExpenseItems.SalePrice FROM tblExpenseItems;

Bound column is 1, limit to list is No, column count 5

And AfterUpdate code:

Me!Cost = Me.Description.Column(1) + Me.Description.Column(2) +
Me.Description.Column(3)

Do columns start numbering as 0 like tab stops?

"Tom van Stiphout" <no*************@cox.netwrote in message
news:6n********************************@4ax.com...
>On Sat, 09 Dec 2006 23:48:24 GMT, "Jimmy" <no**@none.comwrote:

Try this:
Me.Cost =
Me.Description.Column(1)+Me.Description.Column(2) +Me.Description.Column
(3)
Me.Price = Me.Description.Column(2)

I'm assuming Description is a 4-column dropdown?

-Tom.


Dec 11 '06 #6
Problem solved...columns are always treated as strings rather than numbers,
thus cannot be added (calculated). Using the Val() function around each
field solved the problem.
"Jimmy" <no**@none.comwrote in message
news:s8*********************@fe04.news.easynews.co m...
It appears that what may be happening is that access is concatenating the
three columns rather than performing a mathematical calculation. I.e,
rather than column1 Added to column2 and so on it is simply meshing the
two together, thus $5.00 AND $1.00 AND $1.00 becomes $511.00 rather than
$7.00. any thoughts on how to fix this?? FWIW, column(0) is Description, a
text field.

"Jimmy" <no**@none.comwrote in message
news:Os*******************@fe01.news.easynews.com. ..
>Tried changing ! to . with no help. Here is the row source for
Description:

SELECT DISTINCTROW tblExpenseItems.Description,
tblExpenseItems.ProductCost, tblExpenseItems.DeliveryCost,
tblExpenseItems.OtherCost, tblExpenseItems.SalePrice FROM
tblExpenseItems;

Bound column is 1, limit to list is No, column count 5

And AfterUpdate code:

Me!Cost = Me.Description.Column(1) + Me.Description.Column(2) +
Me.Description.Column(3)

Do columns start numbering as 0 like tab stops?

"Tom van Stiphout" <no*************@cox.netwrote in message
news:6n********************************@4ax.com.. .
>>On Sat, 09 Dec 2006 23:48:24 GMT, "Jimmy" <no**@none.comwrote:

Try this:
Me.Cost =
Me.Description.Column(1)+Me.Description.Column(2 )+Me.Description.Column
(3)
Me.Price = Me.Description.Column(2)

I'm assuming Description is a 4-column dropdown?

-Tom.



Dec 12 '06 #7
On Tue, 12 Dec 2006 01:20:22 GMT, "Jimmy" <no**@none.comwrote:

+ is the addition operator.
& is the concatenation operator.

-Tom.

>Problem solved...columns are always treated as strings rather than numbers,
thus cannot be added (calculated). Using the Val() function around each
field solved the problem.
"Jimmy" <no**@none.comwrote in message
news:s8*********************@fe04.news.easynews.c om...
>It appears that what may be happening is that access is concatenating the
three columns rather than performing a mathematical calculation. I.e,
rather than column1 Added to column2 and so on it is simply meshing the
two together, thus $5.00 AND $1.00 AND $1.00 becomes $511.00 rather than
$7.00. any thoughts on how to fix this?? FWIW, column(0) is Description, a
text field.

"Jimmy" <no**@none.comwrote in message
news:Os*******************@fe01.news.easynews.com ...
>>Tried changing ! to . with no help. Here is the row source for
Description:

SELECT DISTINCTROW tblExpenseItems.Description,
tblExpenseItems.ProductCost, tblExpenseItems.DeliveryCost,
tblExpenseItems.OtherCost, tblExpenseItems.SalePrice FROM
tblExpenseItems;

Bound column is 1, limit to list is No, column count 5

And AfterUpdate code:

Me!Cost = Me.Description.Column(1) + Me.Description.Column(2) +
Me.Description.Column(3)

Do columns start numbering as 0 like tab stops?

"Tom van Stiphout" <no*************@cox.netwrote in message
news:6n********************************@4ax.com. ..
On Sat, 09 Dec 2006 23:48:24 GMT, "Jimmy" <no**@none.comwrote:

Try this:
Me.Cost =
Me.Description.Column(1)+Me.Description.Column( 2)+Me.Description.Column
(3)
Me.Price = Me.Description.Column(2)

I'm assuming Description is a 4-column dropdown?

-Tom.

Dec 12 '06 #8
Tom van Stiphout <no*************@cox.netwrote in
news:su********************************@4ax.com:
>
+ is the addition operator.
& is the concatenation operator.

-Tom.
+ is the addition operator.for numeric data
+ is the concatenation operator.for string data (nulls propagate)
& is the concatenation operator.for string and numeric data and
null values do not propagate..
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Dec 12 '06 #9
On 12 Dec 2006 21:34:32 GMT, Bob Quintal <rq******@sPAmpatico.ca>
wrote:

The picture can be (made) even more complicated if you consider
implicit conversion and precedence.
Just trying to cover the basics.
I didn't know that & does not propagate nulls.
Just playing around:

?"1" & vbNullString & "2"
12

?"1" & vbNull & "2"
<first place a bet, then try for yourself, then send me your money
:-)>

-Tom.

>Tom van Stiphout <no*************@cox.netwrote in
news:su********************************@4ax.com :
>>
+ is the addition operator.
& is the concatenation operator.

-Tom.

+ is the addition operator.for numeric data
+ is the concatenation operator.for string data (nulls propagate)
& is the concatenation operator.for string and numeric data and
null values do not propagate..
--
Bob Quintal

PA is y I've altered my email address.
Dec 13 '06 #10
Tom van Stiphout <no*************@cox.netwrote in
news:tk********************************@4ax.com:
On 12 Dec 2006 21:34:32 GMT, Bob Quintal
<rq******@sPAmpatico.cawrote:

The picture can be (made) even more complicated if you
consider implicit conversion and precedence.
Just trying to cover the basics.
I didn't know that & does not propagate nulls.
Just playing around:

?"1" & vbNullString & "2"
12

?"1" & vbNull & "2"
<first place a bet, then try for yourself, then send me your
money
:-)>

-Tom.
I owe you a buck. :-)
but neither vbnull nor vbnullstring (or chr(0)) is a null.

try
dim x as variant, y as variant, z as variant
x = "1"
y = null
z = "2"

debug.print x + y + z,x & y & z, x + y & z , x & y + z
>
>>Tom van Stiphout <no*************@cox.netwrote in
news:su********************************@4ax.co m:
>>>
+ is the addition operator.
& is the concatenation operator.

-Tom.

+ is the addition operator.for numeric data
+ is the concatenation operator.for string data (nulls
propagate) & is the concatenation operator.for string and
numeric data and null values do not propagate..
--
Bob Quintal

PA is y I've altered my email address.



--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Dec 14 '06 #11

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

Similar topics

4
by: BradC | last post by:
I have an MDI parent application with several forms inside it. As the user switches between forms, I am forcing a maximize to keep it filling up the parent window. When the user has one...
1
by: Mac via DotNetMonster.com | last post by:
Hi all, I have a datagrid on a form which is not populated until the user enters selection criteria and clicks a button. Rather than have a blank datagrid when the form is displayed, I would...
0
by: cfaheybestpitch | last post by:
Hi There, I have designed a DTS package which extracts a query into an excel file. It uses a query that changes dynamically based on user preferences, so I have used the dynamic property...
1
by: Supernaut | last post by:
Hi, I have database with a couple of tables. The main table contain foreign keys from the other tables. I have made look-up columns for them. I want to select a value from first look-up column and...
4
by: sherry3718 | last post by:
hi, anyone would guid me to links about these topics? I mean using tables that have lookup datatype feilds in linking 2 forms.
7
by: dtschoepe | last post by:
Hi, I am working on a project for school and I am trying to get my head around something weird. I have a function setup which is used to get an input from stdin and a piece of memory is created...
2
by: =?Utf-8?B?RGFuaWVs?= | last post by:
Hi Guys i wanted to find out, what is the sql statement i need to count the number of rows in search query and also the statement i need for displaying columns that are not null I'm writing...
13
by: TChilton | last post by:
Hi, I am having issues with my lookup tables. When I display the data in an Excel table, the results in the lookup fields appear as the numeric codes rather than in string. We wish to display the...
1
by: Leon Sumter | last post by:
Can an Access 2007 table consisting mainly of lookup columns be sorted according to the fields in the lookup columns. My other subordinate non-lookup tables are all sortable. Leon
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.