HI everyone,
I am using an Access db and asp to track software on pc's. What the final output is SUPPOSED to show is a MASTER list of software from the table (tblSoftware) AND what software is actually on a user's pc from the table tblCompSW. The idea is to have a list for the user to choose from (tblSoftware) and enter license number and type then check off what is installed on his pc. When posted it sends the data to the tblCompSW. When the user goes back to add more software the MASTER list should show "greyed out" checkmarks in check field on software already installed. This is working great if "distinct" checked software for each machine is done; however, if the SAME software is checked I get a greyed out checkbox like normal but also another of the same software item NOT greyed out. I'm assuming I will need to use a Group By or some other type of join. I have experimented but I cannot find a solution thus far. I am a newbie and any help would be appreciated.
-BSL
<form action="default.asp" method="post">
<%
strSQL = "SELECTtblCompSW.SoftwareID,
tblCompSW.EditSoftware,
tblCompSW.ComputerID,tblCompSW.LicenseType, tblCompSW.LicenseNumber, " &_
"tblSoftware.Software, tblSoftware.SoftwareID FROM tblSoftware LEFT JOIN tblCompSW ON " &_
"tblSoftware.SoftwareID = tblCompSW.SoftwareID;"
objRS.Open strSQL, objConn, 3
'Start looping counting variable to allow for unique checkbox values
i = 0
%>
<table class="swlisttable" cellspacing="0">
<tr>
<th>Software</th>
<th>License Type</th>
<th>License Number</th>
<th>Select</th>
</tr>
<%
'Start looping through recordsets until the end of the recordset
Do Until objRS.EOF
i = i + 1
softid = objRS("tblSoftware.SoftwareID")
cbName = "CB_" & softid
active = "Yes"
If objRS("tblCompSW.SoftwareID") = objRS("tblSoftware.SoftwareID") AND objRS("ComputerID") = compid Then
chkd = "checked disabled"
Else
chkd = ""
End If
Response.Write "<tr>" & vbCrlf & _
" <td>" & objRS("Software") & "</td>" & vbCrlf & _
" <td><select class=""swselect"" name=""type_" & softid & """ >" & vbCrlf & _
" <option value=""""></option>" & vbCrlf & _
" <option value=""Single"">Single</option>" & vbCrlf & _
" <option value=""Network"">Network</option>" & vbCrlf & _
" <option value=""Site"">Site</option>" & vbCrlf & _
" <option value=""Enterprise"">Enterprise</option>" & vbCrlf & _
" </select></td>" & vbCrlf & _
" <td><input type=""text"" name=""num_" & softid & """ ></td>" & vbCrlf & _
" <td><INPUT Type='CheckBox'" & "Name='" & cbName & "' Value='NO'" & chkd & ">" & vbCrlf & _
"</tr>"
objRS.MoveNext
Loop
Response.Write "</table>"
%>
<p align="center"><input type="submit" name="addsofttodb" value="Add Software">
<input type="hidden" name="storemanagerid" value="<%=manidw%>">
<input type="hidden" name="storecomputerid" value="<%=selectcomputer%>"></form></p></div>
<%
'Close the recordset object
End If
storecomputerid = Request.Form("storecomputerid")
If storecomputerid <> "" Then
For Each item In Request.Form
If Left( item, 3 ) = "CB_" Then
recID = Mid( item, 4 )
software_type = Request.Form("type_" & recID)
software_num = Request.Form("num_" & recID)
strSQL = "SELECT * FROM tblCompSW;"
objRS.Open strSQL, objConn, 3 ,3
objRS.AddNew
objRS("ComputerID") = storecomputerid
objRS("SoftwareID") = recID
objRS("LicenseType") = software_type
objRS("LicenseNumber") = software_num
objRS("EditSoftware") = True
objRS.Update
objRS.Close
End If
Next
End If
I am using an Access db and asp to track software on pc's. What the final output is SUPPOSED to show is a MASTER list of software from the table (tblSoftware) AND what software is actually on a user's pc from the table tblCompSW. The idea is to have a list for the user to choose from (tblSoftware) and enter license number and type then check off what is installed on his pc. When posted it sends the data to the tblCompSW. When the user goes back to add more software the MASTER list should show "greyed out" checkmarks in check field on software already installed. This is working great if "distinct" checked software for each machine is done; however, if the SAME software is checked I get a greyed out checkbox like normal but also another of the same software item NOT greyed out. I'm assuming I will need to use a Group By or some other type of join. I have experimented but I cannot find a solution thus far. I am a newbie and any help would be appreciated.
-BSL
<form action="default.asp" method="post">
<%
strSQL = "SELECTtblCompSW.SoftwareID,
tblCompSW.EditSoftware,
tblCompSW.ComputerID,tblCompSW.LicenseType, tblCompSW.LicenseNumber, " &_
"tblSoftware.Software, tblSoftware.SoftwareID FROM tblSoftware LEFT JOIN tblCompSW ON " &_
"tblSoftware.SoftwareID = tblCompSW.SoftwareID;"
objRS.Open strSQL, objConn, 3
'Start looping counting variable to allow for unique checkbox values
i = 0
%>
<table class="swlisttable" cellspacing="0">
<tr>
<th>Software</th>
<th>License Type</th>
<th>License Number</th>
<th>Select</th>
</tr>
<%
'Start looping through recordsets until the end of the recordset
Do Until objRS.EOF
i = i + 1
softid = objRS("tblSoftware.SoftwareID")
cbName = "CB_" & softid
active = "Yes"
If objRS("tblCompSW.SoftwareID") = objRS("tblSoftware.SoftwareID") AND objRS("ComputerID") = compid Then
chkd = "checked disabled"
Else
chkd = ""
End If
Response.Write "<tr>" & vbCrlf & _
" <td>" & objRS("Software") & "</td>" & vbCrlf & _
" <td><select class=""swselect"" name=""type_" & softid & """ >" & vbCrlf & _
" <option value=""""></option>" & vbCrlf & _
" <option value=""Single"">Single</option>" & vbCrlf & _
" <option value=""Network"">Network</option>" & vbCrlf & _
" <option value=""Site"">Site</option>" & vbCrlf & _
" <option value=""Enterprise"">Enterprise</option>" & vbCrlf & _
" </select></td>" & vbCrlf & _
" <td><input type=""text"" name=""num_" & softid & """ ></td>" & vbCrlf & _
" <td><INPUT Type='CheckBox'" & "Name='" & cbName & "' Value='NO'" & chkd & ">" & vbCrlf & _
"</tr>"
objRS.MoveNext
Loop
Response.Write "</table>"
%>
<p align="center"><input type="submit" name="addsofttodb" value="Add Software">
<input type="hidden" name="storemanagerid" value="<%=manidw%>">
<input type="hidden" name="storecomputerid" value="<%=selectcomputer%>"></form></p></div>
<%
'Close the recordset object
End If
storecomputerid = Request.Form("storecomputerid")
If storecomputerid <> "" Then
For Each item In Request.Form
If Left( item, 3 ) = "CB_" Then
recID = Mid( item, 4 )
software_type = Request.Form("type_" & recID)
software_num = Request.Form("num_" & recID)
strSQL = "SELECT * FROM tblCompSW;"
objRS.Open strSQL, objConn, 3 ,3
objRS.AddNew
objRS("ComputerID") = storecomputerid
objRS("SoftwareID") = recID
objRS("LicenseType") = software_type
objRS("LicenseNumber") = software_num
objRS("EditSoftware") = True
objRS.Update
objRS.Close
End If
Next
End If