Not sure what exactly you're doing.
Let's make sure we're talking the same thing. To me, a Relationship is
something you create between 2 tables in the Relationships window (or
through DAO using the CreateRelationship method). You cannot create a
relationship between a table and a query, nor can you create a relationship
between a field and part of another field.
If all you're trying to do is create a query that joins the two tables,
attempt to join them normally through the query builder, ignoring the fact
that you don't want to join the complete field from one table to the other
table. Once you've done that, select the SQL view (View | SQL View from the
menu bar) and where the SQL says something like:
ON [h484].[d3] = [table1].[id]
change it to
ON Left([h484].[d3], 7) = [table1].[id]
Another way is to create a query based on table [h484]. Drag all of the
fields to the grid. Add a calculated field by typing the following into an
empty Field cell:
NewID: Left([h484].[d3], 7)
and save the query (for the sake of argument, call the saved query qryh484.
Now, create another query that joins your first table to qryh484, instead of
table h484, and join the table to qryh484 using the NewID field in the
query.
--
Doug Steele, Microsoft Access MVP
Charles Suhr said:
Ok it's early on Sunday morning and I'm not awake yet and trying to do
work stuff. Having problems getting the expression to go on to the
relationship table to allow the join. Ignore previous message about
changing values. It worked just fine that way, but changing data is
not allowed. Any suggestion on what I'm doing wrong to get the
expression to join?
Charles
If I use
D3:Left([h484].[d3],7)
is not null crtiteria
and set relationship of D3 on the h484 table to the corresponding ID
table on my other database. The exprssion does not change orginal
does it? If so is there a way to prevent this?
Charles
You won't be able to create a relationship between the two tables, but you
can join them together in queries.
Create a query with a calculated field of Left([MyField], 7) (replace
MyField with whatever the name of the field should be). You can now join
between the first field and the computed field.