They DAO with related tables

  • Thread starter Thread starter Frank Dulk
  • Start date Start date
F

Frank Dulk

I have a routine that uses they DAO to generate files

He/she/you works perfectly, however, I created a table to store the checking
accounts making possible a customer as soon as it possesses more than a
bill.

I generated the recordset through a consultation and I caught the code SQL.
Don't work.

The tables are related for CodigoGeral. When I execute the query it tests
that created to obtain the code SQL, the consultation me back all the
registrations.

When I apply in the routine it doesn't generate anything.

Some suggestion?

This doesn't work. But yours I to place in the table associated the field
checking account and it negotiates, there it smokes correctly.


Set rst = db.OpenRecordset("SELECT _
Associados.CodigoGeral, Associados.Nome, _
Associados.FormaPagamento, _
Associados.Desfiliado, _
ContasCorrentes.Agencia, _
ContasCorrentes.ContaCorrente _
FROM Associados INNER JOIN ContasCorrentes ON _
Associados.CodigoGeral _
=ContasCorrentes.CodigoGeral _
WHERE (((Associados.FormaPagamento)=3) AND _
((Associados.Desfiliado)=False)) _
ORDER BY Associados.CodigoGeral")


I don't know it was if very clear.

For a recordset of just a table use:

..FIELDS (NOME_DO_CAMPO ")

When is the recordset composed for more than a table, how me reference to
the fields?
 
Hi,

For a recordset of just a table use:

.FIELDS (NOME_DO_CAMPO ")

When is the recordset composed for more than a table, how me reference to
the fields?


With Jet, you can use

.Fields( "TableName.FIeldName" )


if the field name can come from multiple table. Else, if only one table can
supply the field name, the table name (and the dot) is optionnal. You can
(have, with MS SQL Server) use alias:


" SELECT a.f1 As af1, b.f1 As bf1, .... FROM .... "


to differenciate the output fields. If you do, then use the alias name, not
the original fields name:

.Fields("af1")


or

.Fiels("bf1")




Hoping it may help,
Vanderghast, Access MVP
 
Back
Top