Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get the Field Name

Status
Not open for further replies.

PeteCan

Programmer
Jan 15, 2002
60
GB
I have an access database and I'd like to create an Asp page to allow the user to build their own reports.

In order to do this I initially want to populate a dropdown box with the field name so they can select which one they want to report.

I know how to create one when I want the contents of a specifical field but I want to list the names of all the fields in the database
 


set rs at the recordset then loop through fields

for each x in rs.Fields
response.write(x.name & &quot;<br />&quot;)
next
 
Litlle confused there:

I currently have

strSQL=&quot;SELECT * FROM ILDatabase&quot;
Dim objRs
Set ObjRs=ObjConn.Execute(strSQL)
%>
<TABLE border=1 cellPadding=1 cellSpacing=1 width=&quot;75%&quot;>

<TR><TD>
<Select name=&quot;ReportItem&quot;>
<option selected>

<%While NOT ObjRS.EOF%>
<option value=&quot;<%=ObjRS(&quot;CloseDate&quot;)%>&quot;>
<%=ObjRS.Fields(&quot;CloseDate&quot;)%>
<%
objRS.MoveNext
Wend
objRS.Close
conncar.close
Set objRS=Nothing
Set conncar=Nothing
%>
</TD></TR>
</select>
 



strSQL=&quot;SELECT * FROM ILDatabase&quot;
Dim objRs
Set ObjRs=ObjConn.Execute(strSQL)
%>
<TABLE border=1 cellPadding=1 cellSpacing=1 width=&quot;75%&quot;>

<TR><TD>
<Select name=&quot;ReportItem&quot;>
<%
for each x in ObjRs.Fields
response.write(&quot;<option>&quot;& x.name &&quot;</option>&quot;)
next

objRS.Close
conncar.close
Set objRS=Nothing
Set conncar=Nothing
%>
</select>
</TD></TR>


btw
make sure your tag nesting is correct !!
</TD></TR>
</select>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top