Access, query, and fields

Results 1 to 2 of 2

Thread: Access, query, and fields

  1. #1
    Allen Weiss Guest

    Default Access, query, and fields

    Hi,<BR>When writing a query using an Access db, is it necessary to refer to a field by its name (say, if I want to ORDER BY NAME) or can you refer to the field by some other means, such as its position in the db (like ORDER BY FIELD#). If you can&#039t do this, is there any way to get around having to know the field names before hand?<BR><BR>Any help on this would be appreciated!

  2. #2
    Join Date
    Dec 1969

    Default RE: Access, query, and fields

    You can always "SELECT * FROM ..." Which will return all fields. But you want to ORDER BY an unknown field?? How does that work ... how can you ORDER BY your query if you don&#039t know what you want it sorted by?<BR><BR>You can retrieve the names of fields from a recordset object that has already been created:<BR><BR>sFieldName = rs.Fields(0).name &#039Where 0 is the number of the field<BR><BR>-or-<BR><BR>Dim f, rs<BR>&#039... open the rs ...<BR>For each f in rs.fields<BR>response.Write & "&#060; BR&#062;"<BR>Next<BR><BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts