How do I include a third table in a join

L

Lars Pedersen

Hi, hope someone can help me on this one (have tried)

I have this:
strSQL = "SELECT DISTINCT tblSkip.Registreringsnr, tblShip.Shipname as Navn,
tblShip.Type " & _
"FROM tblShip left join [tblMapNr] ON tblSkip.Registreringsnr =
[tblMapNr].ForeignKey"

Its for a search form.

I need to include a third table, tblFormerNames on field "Name",
tblFormerNames.ForeignKey is related to tblSkip.Registreringsnr
One tblSkip.Registreringsnr can have many tblFormerNames.ForeignKey (or
none)


Regards.

Lars
 
P

Per Larsen

Lars said:
Hi, hope someone can help me on this one (have tried)

I have this:
strSQL = "SELECT DISTINCT tblSkip.Registreringsnr, tblShip.Shipname as Navn,
tblShip.Type " & _
"FROM tblShip left join [tblMapNr] ON tblSkip.Registreringsnr =
[tblMapNr].ForeignKey"

Its for a search form.

I need to include a third table, tblFormerNames on field "Name",
tblFormerNames.ForeignKey is related to tblSkip.Registreringsnr
One tblSkip.Registreringsnr can have many tblFormerNames.ForeignKey (or
none)


Regards.

Lars

1. Use the query design view; that's very often the easiest and fastest way to create them.

2. Don't show us the VB(A) code for your query (unless you're having VB coding troubles).

Regards
PerL
 
L

Lars Pedersen

I tried query design, but get an error when trying, about it contains
ambiguous outer joins.
This is vba code behind form that executes when user press a button after
selecting several criteria

/Lars

Per Larsen said:
Lars said:
Hi, hope someone can help me on this one (have tried)

I have this:
strSQL = "SELECT DISTINCT tblSkip.Registreringsnr, tblShip.Shipname as
Navn, tblShip.Type " & _
"FROM tblShip left join [tblMapNr] ON tblSkip.Registreringsnr =
[tblMapNr].ForeignKey"

Its for a search form.

I need to include a third table, tblFormerNames on field "Name",
tblFormerNames.ForeignKey is related to tblSkip.Registreringsnr
One tblSkip.Registreringsnr can have many tblFormerNames.ForeignKey (or
none)


Regards.

Lars

1. Use the query design view; that's very often the easiest and fastest
way to create them.

2. Don't show us the VB(A) code for your query (unless you're having VB
coding troubles).

Regards
PerL
 
Top