WartookMan
Technical User
I have searched Google. I have searched multiple groups on Tek-Tips... but without success. I even posted to the MS Access Forum and they referred me to the ASP Forum.
Using ASP and an MS-Access database, I would like to retrieve a field's "Field Size" property. Is this possible? I want to be able to use it as a first-line trap for input validation, to set the "MAXLENGTH" attribute of an INPUT field on an HTML form.
I have managed to access a field's "Description" Property, and whether it can be Nullable (ie required) or not, but not it's size. I have even tried outputting ALL Properties for all Fields for all Tables available, but there doesn't seem to be a Property for the size!
This was my code for all the Properties available:
Ultimately I'd like to create something like:
Any help / ideas would be most appreciated.
Pete.
Web Developer & Aptrix / IBM Lotus Workplace Web Content Management (LWWCM) Specialist
w: e: Pete.Raleigh(at)lclimited.co.uk
Using ASP and an MS-Access database, I would like to retrieve a field's "Field Size" property. Is this possible? I want to be able to use it as a first-line trap for input validation, to set the "MAXLENGTH" attribute of an INPUT field on an HTML form.
I have managed to access a field's "Description" Property, and whether it can be Nullable (ie required) or not, but not it's size. I have even tried outputting ALL Properties for all Fields for all Tables available, but there doesn't seem to be a Property for the size!
This was my code for all the Properties available:
Code:
Dim objTable, objColumn, objProp
For Each objTable in objADOXDatabase.Tables
If objTable.Type = "TABLE" then
Response.Write objTable.Name & "<br>"
For Each objColumn in objTable.Columns
Response.Write " " & objColumn.Name & " - " & objColumn.Attributes & "<br>"
For Each objProp in objColumn.Properties
Response.Write " " & objProp.Name & " - " & objProp.Value & " - " & objProp.Attributes & "<br>"
Next
Next
Response.Write "<p>"
End If
Next
Code:
...
<tr>
<td>
<label for="<%= fldID %>" class="normal" id="lbl_<%= fldID %>"><%= fldLabel %></label>: </td>
<td><%
If Not fldNotReqd Then
%><span class="fld_reqd">*</span><%
End If
%></td>
<td><input type="text" maxsize="<%= fldSize %>" size="20" id="<%= fldID %>" name="<%= fldID %>"></td>
</tr>
...
where:
fldID - field's "Name" property in Access
fldLabel - field's "Description" property
fldNotReqd - field's "Nullable" property
fldSize - field's "Field Size" property
Pete.
Web Developer & Aptrix / IBM Lotus Workplace Web Content Management (LWWCM) Specialist
w: e: Pete.Raleigh(at)lclimited.co.uk