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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

display boolean on webpage 1

Status
Not open for further replies.

tradewise

Programmer
Feb 11, 2003
10
GB
I have an access database that has a yes/no field. What I am attempting is to display the result of this field in a checkbox on a webpage.

If I use a text box it displays either 'true' or 'false' depending on the value in the database. As soon as I change it to a checkbox it just does nothing ie the checkbox remains unchecked.

Any help would be much appreciated.

Regards
 
There are several ways, here is a simple example that should get you started. The main thing is that you must specify that the checkbox is 'checked' by using this attribute.

Code:
bYourValue = oYourRecordset.Fields("YourYesNoField")

if bYourValue = true then
response.write("<input type=""checkbox"" id=""someid"" name=""somename"" checked=""true"" />")
else
response.write("<input type=""checkbox"" id=""someid"" name=""somename"" />")
end if

A smile is worth a thousand kind words. So smile, it's easy! :)
 
damber

it works a treat

I'll have this one tucked away for future use.

Thanks a lot
 

No problem, glad to help.

A smile is worth a thousand kind words. So smile, it's easy! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top