473,399 Members | 3,603 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,399 software developers and data experts.

Tyoe conversion error in update query

Hi,

I am running an update query where i am basically stripping of the last digit of a data. Thus for example:

20110068876v
180068877v

should become,

20110068876
180068877

to do this i am running update query with Update To as

Left([Fieldname],Len([Fieldname]-1))

However i am getting a type conversion error on all the rows.

Could someone please help me out here

Thanks!
Jun 14 '10 #1

✓ answered by OldBirdman

The formula
Expand|Select|Wrap|Line Numbers
  1. Left([Fieldname],Len([Fieldname]-1))
should be
Expand|Select|Wrap|Line Numbers
  1. Left([Fieldname],Len([Fieldname])-1)

6 1881
jimatqsi
1,271 Expert 1GB
I presume you are updating the same field as the source of the data. So you are starting out with a string field and the program thinks you are plugging a number into it.

Try wrapping your equation in a Cstr function to make sure the program knows the result is a string and not a number. So your code will look like this:
Cstr(Left([Fieldname],Len([Fieldname]-1)))

Also, are you sure all the fields are populated? What happens if one of these has a null value? If that's possible, you need to code around that also.

Jim
Jun 14 '10 #2
Thanks. I tried running this but am still getting the same error of 'type conversion failure' for all fields. I have confirmed that all the fields are populated with data and none of them is blank.

Also, the Data Type is currently text, although I would be eventually wanting to convert these to numbers as I would be using them to link to another database which has this data in number format only.

Regards,
Jun 14 '10 #3
jimatqsi
1,271 Expert 1GB
Are you joining two or more tables in this query? Perhaps you are joining a text field to a numeric field. I believe that will give this type of error.

Jim
Jun 14 '10 #4
OldBirdman
675 512MB
The formula
Expand|Select|Wrap|Line Numbers
  1. Left([Fieldname],Len([Fieldname]-1))
should be
Expand|Select|Wrap|Line Numbers
  1. Left([Fieldname],Len([Fieldname])-1)
Jun 14 '10 #5
jimatqsi
1,271 Expert 1GB
Of course, yes, my bad. Good catch, OldBirdman.

Jim
Jun 14 '10 #6
Thanks a lot guys! this worked perfectly.
Jun 15 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Colleyville Alan | last post by:
I am trying to run an update query to take information in a field and remove the last 4 chars. For example, the following piece of data: DAA1.CTF, should be converted to DAA1 (without the ".CTF")....
4
by: deko | last post by:
I'm trying to update the address record of an existing record in my mdb with values from another existing record in the same table. In pseudo code it might look like this: UPDATE tblAddress SET...
7
by: Mark Carlyle via AccessMonster.com | last post by:
I have this update query that I am trying to run. I know the syntax is messed up but do not know how to correct it. Select 'UPDATE', Transactions,'Set = where = ' From "Get Daily Balances" ...
1
by: Riley DeWiley | last post by:
I have an UPDATE query that is always setting 0 records. When I cut and paste the SQL into Access and use it, it fails in the same way unless I coerce the date fields to be '=now()', in which case...
2
by: midlothian | last post by:
Hello Trying to update a memo field in an update query using the Replace function, and am getting a type conversion error. Here is my parameter: CStr(Replace(CStr(),"$",Chr$(13) & Chr$(10))) ...
2
by: Reedsp | last post by:
OS: MS XP Access version: 2003 SP2 I am trying to use an update query to replace quote marks with nothing. In essence, I'm removing quote marks. I get a error message when a field is empty or...
11
by: gnortenjones | last post by:
I have a linked table (to an oracle db), and I am trying to run a simple update query against it to change some data, but I am getting the following error: "...didn't update 0 fields due to a type...
0
by: robsjonathan | last post by:
hello world, i have two tables stock and sales where one to many relationship is created. The join type is " 2: include all records from stock table and only those from sales where the joined...
6
by: GoNowhere | last post by:
Hi There, I'm attempting to update a short date formatted field with a consistent year without changing the Month or Day. Below is what I have so far, when trying to update it however I get a...
33
by: mjvm | last post by:
HI, I have a main table (tblStudents) that holds students where the unique field is StudentID; and a related table (tblNotes) on a one-to-many relationship, where the unique field is NotesID, and...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.