Parag wrote:
Quote:
I have a bunch of columns e.g. Day1-A, Day1-B,... Day2-A, Day2-B, etc.
and want to write a query to for example, return all Day2 columns
only.
How do I do this please? |
I created a table called Table1 with 4 fields; ID, First, Last, Addr. I
then ran this code and it displayed ID1, FirstName, LastName, Address.
Sub QueryHeads()
Dim strQuery As String
Dim rst As Recordset
Dim fld As Field
Dim intFor As Integer
strQuery = "Select ID As ID1, First As FirstName," & _
"Last As LastName, Addr As Address From Table1"
Set rst = CurrentDb.OpenRecordset(strQuery, dbOpenSnapshot)
For intFor = 0 To rst.Fields.Count - 1
Debug.Print rst(intFor).Name & " "
Next
rst.Close
Set rst = Nothing
End Sub
That might not be what you want. Check out this link
http://bytes.com/topic/access/answer...tables-caption
And this as well
http://www.fmsinc.com/tpapers/access...hly/index.html