String to Numeric

J

JimP

I have an "order details" table that has a text identifier for the "order
number" (e.g. "abc"). I would like to create a numeric identifier that
uniquely identifies each order (e.g. 1 to 10).

Is there a way to do this via a query?

I can think of a way to do this with code, opening the table as a recordset
and then incrementing a counter each time the text identifier changes - but
this seems inefficient.
 
J

JimP

There any numerous "order detail" records per order. An autonumber field
would uniquely identify each order detail record. I need to give each group
of "order" records a unique identifier.
 
R

Rick Brandt

JimP said:
There any numerous "order detail" records per order. An autonumber
field would uniquely identify each order detail record. I need to
give each group of "order" records a unique identifier.

What's wrong with just using the text field?
 
J

JimP

This is a retrofit to an existing application that requires a join to a
numeric "order number" field (which I can't change).
 
S

Stephen K. Young

JimP said:
This is a retrofit to an existing application that requires a join to a
numeric "order number" field (which I can't change).

You can create your join, then go to SQL view and convert the join to
something like:
CLng(Table1.TextField) = Table2.NumericField.

Or, if you are hesitant to depend on correct numeric values, you can go the
other way in the join:
Table1.TextField = CStr(Table2.NumericField)

You may also want to add some Nz() conversions also, if you can have Nulls
in the join.

- Steve
 

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