Re: Referencing data column by it's name



Dave Patrick wrote:
It's more efficient to query only the columns you need instead of
using *

Very true.


select fieldname1, fieldname2 from myTable

var_firstname = rs!fieldname1

That syntax will only work in VB/VBA ... not in vbscript which is what the
OP is using.

Actually, given the query you suggested, nothing beats:

var_firstname = rs(0)

If you're trying to make your code more "readable", use constants:

const FirstName = 0
.....
var_firstname = rs(FirstName)


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


.



Relevant Pages

  • Re: Referencing data column by its name
    ... It's more efficient to query only the columns you need instead of using * ... select fieldname1, fieldname2 from myTable ... Dave Patrick ....Please no email replies - reply in newsgroup. ... conn.open "databasename" ...
    (microsoft.public.data.ado)
  • Re: Form not showing correct record order
    ... Cynd wrote: ... Use a query for the subform instead of the table and sort that query as desired. ... ORDER BY FieldName1, FieldName2, etc... ...
    (microsoft.public.access.forms)