Add dashes to field....

D

Dustin

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?
 
J

John W. Vinson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top