PC Review


Reply
Thread Tools Rate Thread

Add dashes to field....

 
 
Dustin
Guest
Posts: n/a
 
      11th Jan 2010
I have a table titled Internet Usocs 1-11-10 that I am trying to update the
field titled Primary Phone. I need to make the Primary Phone field to
included dashes (###-###-####). I used the following in an update query:

Format("Primary Phone","###-###-####")

I also used an SQL statment below:

UPDATE Internet Usocs 1-11-10 SET Internet Usocs 1-11-10.Primary Phone =
Format([Primary Phone],"@@@-@@@-@@@@")
WHERE (((Len([Primary Phone]))=10));

Each time I get an error stating: Microsoft Office Access didn't update
5626 fields(s) due to a type conversion failure.

Does anyone know what my problem could be?

 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      11th Jan 2010
On Mon, 11 Jan 2010 08:31:02 -0800, Dustin <(E-Mail Removed)>
wrote:

>I have a table titled Internet Usocs 1-11-10 that I am trying to update the
>field titled Primary Phone. I need to make the Primary Phone field to
>included dashes (###-###-####). I used the following in an update query:
>
>Format("Primary Phone","###-###-####")
>
>I also used an SQL statment below:
>
>UPDATE Internet Usocs 1-11-10 SET Internet Usocs 1-11-10.Primary Phone =
>Format([Primary Phone],"@@@-@@@-@@@@")
>WHERE (((Len([Primary Phone]))=10));
>
>Each time I get an error stating: Microsoft Office Access didn't update
>5626 fields(s) due to a type conversion failure.
>
>Does anyone know what my problem could be?


My guess would be that your Primary Phone field is of Number datatype. Numbers
can't contain hyphens (well, a negative number has *one*...) The field should
be changed to Text datatype.

In addition, since you're (unwisely) using blanks in fieldnames, you must
delimit your table and field names with square brackets. As far as Access is
concerned your UPDATE query is referencing several fields, named "Internet"
and "Usocs" and "1-11-10" and "Primary" and "Phone". Blanks are meaningful,
and computers are very stupid! Try changing this to

UPDATE [Internet Usocs 1-11-10] SET [Internet Usocs 1-11-10].[Primary Phone] =
Format([Primary Phone],"@@@-@@@-@@@@")
WHERE (((Len([Primary Phone]))=10));

Better, change your fieldnames to contain only letters, numbers and
underscores (e.g. PrimaryPhone).

The fact that your *table name* contains what appears to be a date is another
huge red flag: dates are *data* which should be stored in a date field in your
table; if you currently have a different table for each date you're in for
monstrous problems integrating the data.
--

John W. Vinson [MVP]
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting Text Field with dashes terryh70 Microsoft Access Reports 1 27th Mar 2008 08:50 PM
How can you delete dashes(hyphens) in a text field i.e T-123-123-. =?Utf-8?B?bmV3YXR0aGlzOTg1NQ==?= Microsoft Access 7 3rd Jan 2005 05:51 PM
Removing dashes from a field =?Utf-8?B?SkMgTmV3c2dyb3Vw?= Microsoft Access External Data 1 11th Nov 2004 04:54 AM
Removing dashes from a text field =?Utf-8?B?SkMgTmV3c2dyb3Vw?= Microsoft Access External Data 1 10th Nov 2004 10:20 PM
Replace dashes stored in text field Don Microsoft Access Queries 1 20th Aug 2003 03:38 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:42 PM.