Re: How can i get the "true" name of an aliased field?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Patrick wrote:
Does any anyone know how can I get the real name of a field when using
aliases ?
I'm opening an ADO recordset with an SQL string which goes something
like
"SELECT Surname & ' ' & Name as Operator FROM People"
I'm doing this mainly for descriptive reasons, but I also need the
true source of the field ( = Surname & ' ' & Name).
DAO used to have the SourceField() method, which is not supported by
ADO.
Is there an alternative ?

A post by ekkehard in another thread gave me another idea, but it will
require you to be rigid in your coding practices:

Use rs.Source to get the sql statement that was used to populate the
recordset, and parse the statement for the "real name" of the field. Are
you familiar with regular expressions? It could be done with builtin
vbscript string functions, but many would declare that using regex is
easier and more efficient. Different strokes and all that...

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


.



Relevant Pages

  • Re: Using VBA to create a Table in Access database
    ... "Set rst = qdf.OpenRecordset" ... in data which forms the WHERE clause of the sql statement. ... i declared qdf.sql = sqlstring followed by ... If you want to modify the code so that you pass in a simple SQL string, ...
    (microsoft.public.access.modulesdaovba)
  • Re: Nested Datalists
    ... This SQL statement returns all the information that I need (Drawing #, ... (MaxOfDCN) ... this SQL string as the DataSource for one of my datalists. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: newbie - sql UPDATE statement
    ... You seemed to refer to the same ... "Newbee Adam" wrote in message ... > I do think a replace function can be used in an sql statement like I use ... > outside an sql string like: ...
    (microsoft.public.access.gettingstarted)
  • Re: How can i get the "true" name of an aliased field?
    ... I'm opening an ADO recordset with an SQL string which goes something ... I'm doing this mainly for descriptive reasons, ... This email account is my spam trap so I ...
    (microsoft.public.data.ado)
  • ADP forms-Which is better-bound recordsource or dynamic recordset?
    ... I have read and read and read posts on how to bind a form directly to ... an ADO recordset and other similar topics, but what I'm looking for is ... setting the form's Recordsource Property to the SQL statement ... binding the form to a stored procedure on the server, ...
    (microsoft.public.access.formscoding)