Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query: Connecting string and numeric fields

Status
Not open for further replies.

foxrainer

Programmer
Jan 10, 2002
270
0
0
US
Hi,

I need to build a query in which two tables are connected.

However,
one table uses the ID field as a text, the other as a numeric expression.

I am not able to change the field expressions, as both tables are used in seperate programs, but DO use the same numbers ( i.e., an ID may be 20002 in the text_ID field as well as the numeric_ID field).

In other programs I could use the: Str(numeric_field) = string_Field, but I can't find that in access.

Also, it would help if this could be done directily with the expression builder.

Thank you in advance

Rainer
 

Hi,

1. Do you have any IDs that have leading zeros? So if your ID is 8 characters in length...
Code:
Where A.ID = Right("0000000"&B.ID, 8)


Skip,
[sub]
[glasses] [red]Be advised:[/red] The dyslexic, agnostic, insomniac, lays awake all night wondering...
"Is there really a DOG?" [tongue][/sub]
 
Skip,

no leading Zero's in either the numeric nor string ID.

But, as mentioned, one field is Numeric, the other Text! In order to relate the two, one would need to be converted.

Somehow, it should work to do the following:
WHERE VAL(textID)=StringID

However, I tried that and it didn't work.
 
I got this to work to link an autonumber and text id:
Code:
SELECT Staff.Staff_name, Staff2.Name
FROM Staff INNER JOIN Staff2 ON Staff.staffid = int(Staff2.Id);

traingamer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top