How to Get Table Name with Field Name in Query ?

  • Thread starter Thread starter SANJAY SHAH-MICROBRAIN COMPUTERS PVT. LTD.
  • Start date Start date
S

SANJAY SHAH-MICROBRAIN COMPUTERS PVT. LTD.

Dear Sir,

I am using following Query for Reports purpose.

SELECT FaAccountMaster.AccountCode, FaAccountMaster.AccountName FROM
FaAccountMaster ORDER BY FaAccountMaster.AccountName

In Recordset I am getting field name with AccountCode & AccountName but I
wants Field Name must be FaAccountMaster.AccountCode &
FaAccountMaster.AccountName

How I can get it ?

Sanjay Shah
 
You could loop through the fields of your DAO recordset like this:
For Each fld In rs.Fields
Debug.Print fld.Name, fld.SourceTable & "." & fld.SourceField
Next
 
Dear Allen,

If i am using more than 18 table to get recordset then How to field out.

Please note I want to Query without any coding ?

Sanjay Shah
 
I don't think I understand your question.

You want to examine the properties of the fields in a Recordset, but you do
not wish to use any code?
 
Hi Sanjay,

PMFBI

I don't believe you would want to include
the "extra dot" since it plays such an important
role in disambiguating objects, i,e.,

qryYourQuery.FaAccountMaster.AccountCode

may be a big gotcha later down the road.

Is there any reason why you cannot get by with
an abbreviated alias w/o the dots, such as...?

SELECT
FaAccountMaster.AccountCode As FaAMAccountCode,
FaAccountMaster.AccountName As FaAMAccountName
FROM
FaAccountMaster
ORDER BY
FaAccountMaster.AccountName

or fullname alias w/o dots

SELECT
FaAccountMaster.AccountCode As FaAccountMasterAccountCode,
FaAccountMaster.AccountName As FaAccountMasterAccountName
FROM
FaAccountMaster
ORDER BY
FaAccountMaster.AccountName

Apologies again for butting in,
especially if I misunderstood.

good luck,

gary



"SANJAY SHAH-MICROBRAIN COMPUTERS PVT. LTD."wrote:
 
Gary said:
Hi Sanjay,

PMFBI

I don't believe you would want to include
the "extra dot" ...

My impression is that the OP just wanted to display some names in a
Report. If so, the desired name could be in a label control there, and
could contain just about anything.


Depending on what you want to display in the Report, you might want to
create a Label control in the Page Header section and set its "Caption"
property to "FaAccountMaster.AccountCode". Create another Label control
whose Caption is "FaAccountMaster.AccountName".

Data from the Query would appear in the Detail section, displayed via
other controls, such as List Boxes.

-- Vincent Johns <[email protected]>
Please feel free to quote anything I say here.
 
Sorry...my impression was that
18 tables were involved in his report
query

and possibly he had AccountCode
and AccountName that could come from
more than one table

and he wanted some way to distinguish
where they came from

I'll try to read more carefully next time...
 
Gary said:
Sorry...my impression was that
18 tables were involved in his report
query

and possibly he had AccountCode
and AccountName that could come from
more than one table

and he wanted some way to distinguish
where they came from

I'll try to read more carefully next time...

I'm not sure it's a matter of careful reading -- the original message
looked a bit ambiguous to me. I was just interjecting an alternate
interpretation on the OP's question, and I could very well have been
wrong; sometimes a bit of guesswork is needed.

-- Vincent Johns <[email protected]>
Please feel free to quote anything I say here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top