This topic is locked

Required Icon Not Showing

6/9/2003 4:15:35 PM
ASPRunnerPro General questions
U
unitedwebcenters author

I have been unable to get the "required field" icon to show next to any of the required fields in my Access database. No matter what combination of settings I use on the item for setting the "Required" and "Allow Zero Length" properties within Access, the icon doesn't show.
The generated code looks like it checking the Attributes bits for "adFldMayBeNull" and "adFldIsNullable", which indicates to me the code is trying to use whether the field can accept or return nulls as an indication of whether the field is required. I'm guessing this is because ADO doesn't support the concept of a "required" field, as this is more of a DBMS thing. However, I can't seem to get the required icon to show even if I manipulate the settings of the "Allow Zero Length" property within Access.
Is this just something that is not supported when using an Access database, or is there a way for me to get this working?
Thanks in advance,
Jim Fennell

Vice President

United Web Centers, LLC

admin 6/9/2003

Jim,
MS Access do not expose "Allow Zero Length" property to ADO. I'm aware of this problem.
I found that this property can be accessed through ADOX but this way is less reliable. ADOX may not be installed on some servers.
Btw, databases like MS SQL Server return required attrimutes for required fields.
Sergey Kornilov

U
unitedwebcenters author 6/10/2003

Sergey,
Thanks for the quick response. Is there any hope for a fix in future versions for working with an Access database. We'd love to be running everything off SQL server, but as a startup, we haven't yet been able to afford the $12,000 for the license! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=264&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />
Jim Fennell

Vice President

United Web Centers, LLC

admin 6/10/2003

Jim,
here is the possible workaround that allows to read Allow Zero length property using ADOX.

  1. Place this somewhere in the begining of your edit.asp page

set oCat = server.CreateObject("ADOX.Catalog")

oCat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db/yourdatabase.mdb") & ";Jet OLEDB:Engine Type=5"
if Left(strTableName,1)="[" then

    strADOXTableName = Mid(strTableName,2,len(strTableName)-2)

else

    strADOXTableName = strTableName

end if


Adjust path to your database if required.
2.

Replace
if (rs.Fields.Item(i).Attributes and 96)=0 then
with
if (rs.Fields.Item(i).Attributes and 96)=0 or _

    oCat.Tables(strADOXTableName).Columns(rs.Fields.Item(i).Name).Properties("Jet OLEDB:Allow Zero Length")=False then


3. Put Set oCat = Nothing somewhere close to the end of file.
Seems to be working fine.
Best regards,

Sergey Kornilov