Hello everyone,
A former partner of mine has just written a code that would list all toys that have not been sold.
The code works fine except that there is a field called sold which determines whether a toy has been sold or not.
When records are displayed, sold will have a value of True displayed on the form.
We would like to change this value from True to a checkbox.
Normally, I would have no problem creating an input box with checkboxes, with an if statement that says if toy is sold, put a checkmark on the chekbox, otherwise leave it blank.
Given the way the code is written, I am stumped with trying to find a solution.
sold is an access database field with yes/no datatype.
Below is the relevant code.
If you would be kind to help with a function that will allow me to change the value of sold from True to a checkbox, this would be greatly appreciated.
Thank you very much in advance.
A former partner of mine has just written a code that would list all toys that have not been sold.
The code works fine except that there is a field called sold which determines whether a toy has been sold or not.
When records are displayed, sold will have a value of True displayed on the form.
We would like to change this value from True to a checkbox.
Normally, I would have no problem creating an input box with checkboxes, with an if statement that says if toy is sold, put a checkmark on the chekbox, otherwise leave it blank.
Given the way the code is written, I am stumped with trying to find a solution.
sold is an access database field with yes/no datatype.
Below is the relevant code.
If you would be kind to help with a function that will allow me to change the value of sold from True to a checkbox, this would be greatly appreciated.
Thank you very much in advance.
Code:
function PagingDisplay()
if strCol = "" then strCol = "toy_Name"
strSQL = "SELECT id, toy_name,sold " & _
"FROM toynames where sold = True"
if strCol <> "" then strSQL = strSQL & "ORDER BY " & strCol & " " & strSrt
strHeader = "<table border='0' cellspacing='1' cellpadding='2' width='660'> " & _
"<tr bgcolor=B6C7E5> " & _
"<td class='header10'><| col_u_1 |><b>First Name</b><| col_d_1 |></td> " & _
"<td class='header10'><| col_u_2 |><b>Toy Name</b><| col_d_2 |></td> " & _
"<td class='header10' align='right'><| col_u_3 |><b>sold</b><| col_d_3 |></td> " & _
"</tr>"
strTemplate = "<tr class='<| class |>'> " & _
"<td class='smalltext' valign='top'><a href='<| link |>'><| row1 |></a></td> " & _
"<td class='smalltext' valign='top'><| row2 |></td> " & _
"<td class='smalltext' valign='top'><| row3 |></td> " & _
"</tr>"
strFooter = "</table>"
strNavigation = "<table border='0' cellspacing='1' cellpadding='2' width='700'> " & _
"<tr bgcolor=FFFFFF> " & _
"<td class='smalltext'><| navigation |></td> " & _
"</tr></table>"
iNumberOfFields = 3
Set objPagination = New cPagination
objPagination.DetailString = "NorthIndex.asp?report=2&key="
objPagination.SQLString = strSQL
objPagination.NumberOfFields = iNumberOfFields
redim strFormat(iNumberOfFields)
strFormat(0) = ""
strFormat(1) = ""
strFormat(2) = ""
objPagination.DataFormat = strFormat
redim strSort(iNumberOfFields)
strSort(0) = "id"
strSort(1) = "toy_name"
strSort(2) = "sold" <-- the function call will be here.
objPagination.SortColumns = strSort
objPagination.SortOrder = strSrt
objPagination.SortField = strCol
redim strSum(iNumberOfFields)
strSum(0) = ""
strSum(1) = ""
strSum(2) = ""
objPagination.SumColumns = strSum
objPagination.RecordsPerPage = 10
objPagination.TemplateHeader = strHeader
objPagination.Template = strTemplate
objPagination.TemplateFooter = strFooter
objPagination.TemplateNavigation = strNavigation
response.write objPagination.ShowRecords(iPageCurrent)
Set objPagination = nothing
end function