December 21st, 2010, 10:56 AM
Using Access Caption as Title
I have an Access database that gets info from an Excel spreadsheet and places it in tbl1. I have built an asp page that loads information from tbl1 in my Access database. The code below is set to get the info from Field1 and I have repeated it for Field1 to Field16. Additionally within my Access database I insert caption information which is the column titles from the spreadsheet.
As part of my asp page there are column titles in HTML that at the moment are hand typed in. The code below shows a few title in my HTML page.
sql = "SELECT * FROM tbl1 "
If Not IsEmpty(Request("FIELD1")) Then
strFIELD1 = Trim(Request("FIELD1"))
If strFIELD1 <> "" Then
If blnWhere Then sql = sql & "AND " Else sql = sql & "WHERE " : blnWhere = True
sql = sql & "(FIELD1 LIKE '%" & Replace(strFIELD1, "'", "''") & "%') "
Is there an asp code that could extract all the captions from the Access database and insert them into the HTML section of the page?
<td width="5%>Record No</td>
Hope this makes sense
December 21st, 2010, 08:14 PM
If by captions you mean the column names in the db, yes you can get them programatically. Most databases provide a special view INFORMATION_SCHEMA that you can query for table names, column names, etc.
There may be examples in this forum, a search here or google will find you some sample code.
I've never been able to appreciate the sublime arrogance of folks who feel they were put on earth just to save other folks from themselves .." - Donald Hamilton
January 3rd, 2011, 08:22 AM
January 21st, 2011, 11:18 AM