Talk About Network

Google





Software > Access Development Tool Kids > return field na...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 2116 of 2154
Post > Topic >>

return field name from a function to a query

by "marta_chukh" <u45414@[EMAIL PROTECTED] > Aug 11, 2008 at 07:38 PM

Hello,

I have form with 12 buttons that are calling 12 queries. I'm trying to
have
only one query instead of 12 as all queries are the same except some of
the
field names (column names) in the SELECT statement.

I was trying to create a function with SELECT Case statement in VBA that
would change these field names depending on which button was clicked.
However,
the function is returning name of the field (column name) as string. So,
when
I run the query, instead of values of the specified column name, I receive
the returned column name in each row.

My problem is that I don't know how to return that field name(column name)
as
the field name not as a string.

Please HELP. Also, if you have any other suggestions on how to make one
query
out of 12 will be appreciated.

The following is the query that i try to modify:
SELECT [Global Form Table].[Entity Name], 
dbo_ldr_acct_bal.ldr_entity_id, dbo_ldr_acct_bal.centre, dbo_ldr_acct_bal.
account, dbo_ldr_acct_bal.product, dbo_ldr_acct_bal.market, dbo_ldr_acct.
acct_type_code, dbo_ldr_acct.acct_descp_1, dbo_ldr_acct.acct_descp_2,
dbo_ldr_acct_bal.curr_type, dbo_ldr_acct_bal.curr_code, Get_Period() AS
acur
FROM [Global Form Table] INNER JOIN (dbo_ldr_acct_bal LEFT JOIN
dbo_ldr_acct
ON (dbo_ldr_acct_bal.market = dbo_ldr_acct.market) AND (dbo_ldr_acct_bal.
product = dbo_ldr_acct.product) AND (dbo_ldr_acct_bal.account =
dbo_ldr_acct.
account) AND (dbo_ldr_acct_bal.centre = dbo_ldr_acct.centre) AND
(dbo_ldr_acct_bal.ldr_entity_id = dbo_ldr_acct.ldr_entity_id)) ON [Global
Form Table].GTNIEntity = dbo_ldr_acct_bal.ldr_entity_id
GROUP BY [Global Form Table].[Entity Name],
dbo_ldr_acct_bal.ldr_entity_id,
dbo_ldr_acct_bal.centre, dbo_ldr_acct_bal.account,
dbo_ldr_acct_bal.product,
dbo_ldr_acct_bal.market, dbo_ldr_acct.acct_type_code, dbo_ldr_acct.
acct_descp_1, dbo_ldr_acct.acct_descp_2, dbo_ldr_acct_bal.curr_type,
dbo_ldr_acct_bal.curr_code
HAVING (((dbo_ldr_acct_bal.centre)>=[From Department] And
(dbo_ldr_acct_bal.
centre)<=[To Department]) AND ((dbo_ldr_acct_bal.account)>=[From Account]
And
(dbo_ldr_acct_bal.account)<=[To Account]) AND
((dbo_ldr_acct_bal.curr_type)
="B1") AND ((dbo_ldr_acct_bal.curr_code)="CAD"));
 




 5 Posts in Topic:
return field name from a function to a query
"marta_chukh" &  2008-08-11 19:38:36 
Re: return field name from a function to a query
"marta_chukh" &  2008-08-11 19:50:47 
Re: return field name from a function to a query
John W. Vinson <jvinso  2008-08-11 16:54:33 
Re: return field name from a function to a query
"Marta via AccessMon  2008-08-12 13:32:17 
Re: return field name from a function to a query
"Douglas J. Steele&q  2008-08-12 17:16:32 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 11:12:47 PST 2009.