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!

Problem w/ Relationship 1

Status
Not open for further replies.

ohmbru

Technical User
Jul 13, 2001
161
0
0
US
I have 2 databases that use similar data. Most of the time the datatypes match. I can't create a relationship I need in my query.

The field is PolicyNumber. In database 1, the field is imported as a number (1234567). In database 2, as text(1-234567). The source for DB 2 includes a dash (-) which is why it is a text field.

I now import DB 1 PolicyNumber as a text field and input mask 0\-000000. This still does not allow me to make the relationship in my query. Apparently, the dash in DB 1 is not recognized.

Any thoughts on how to crack this nut?

Thanks,
Brian
 
Try to import PolicyNumber without changes to the data but as text and then update the field as:
"0"&"-"&"[PolicyNumber]"
 
This is along the lines I was thinking, but it always returns a zero in the first position, then the full 7-didgit number (0-1234567). Is there a way to isolate the first position of the field in an expression like this?

Brian Brian
 
Where does the first part of the PolicyNumber comes from?
 
The PolicyNumber is stored in a .txt file like this: "1234567"

I may be successful if I could break up this field like you suggest.

[PolicyNumber] & "-" & [PolicyNumber]
1st position positions 2-7

But I don't know how to define the parts of the field. Brian
 
...to get "1-234567" Brian
 
Check those 2 functions: Left(string, length) and Mid(string, start[, length])
 
That worked. I still can't make the relationship but I think I will have to make a table first.

Thanks for your speedy help!

Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top