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

Status closed…Help still!

Status
Not open for further replies.

redbay

Technical User
Oct 13, 2003
145
GB
I’m still trying to get this to work
I have 2 tables in my database, tblCustomer and tblAction; both have status fields in them. One customer can have many actions against them. On my Dreamweaver page I have a recordset from tblCustomer showing all fields, including status. I would like it to show closed when all the actions against the customer are closed (tblAction – ActionClosed) baring in mind that there may be many actions, and open if not all of the actions are closed. In my mind I get something like

If all records in tblAction.ActionClosed = Closed Then
tblCustomer.Status = Closed

End If


 
You are going to have to loop through all of the records for a customer and set a status variable to closed or open then display based on that.

[Peace][Pipe]
 
Sorry, i have no idea how to loop through records or to set a status variable?????
 
So you must have a repeat region on your page, can you post all of the code in your repeat region here please

Cheech

[Peace][Pipe]
 
<%
While ((Repeat1__numRows <> 0) AND (NOT rsEditCust.EOF))
%>
<tr>
<td><center><%=(rsEditCust.Fields.Item("ComplaintID").Value)%> - <%=(rsEditCust.Fields.Item("CustomerID").Value)%></center></td>
<td><a href="javascript:;" onClick="MM_openBrWindow('custinfo.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "CustomerID=" & rsEditCust.Fields.Item("CustomerID").Value %>','','scrollbars=yes,width=520,height=520')"><%=(rsEditCust.Fields.Item("CustomerFullName").Value)%></a></td>
<td><% If (rsEditCust.Fields.Item("Status").Value) = True Then %>
<font color="#FF0000"><center>Closed</center></font>
<% Else %>
<font color="#008000"><center>Open</center></font>
<% End If %>
<td><div align="center"><a href="actdet.asp?<%= Server.HTMLEncode(MM_keepBoth) & MM_joinChar(MM_keepBoth) & "CustomerID=" & rsEditCust.Fields.Item("CustomerID").Value %>">Action details</a></div></td>
<td><a href="actnew.asp"><center>Add action</center> </td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsEditCust.MoveNext()
Wend
%>
 
Try looking at this (untested) code, see what I have done and play about with it to get your desired results
Code:
<% 
While ((Repeat1__numRows <> 0) AND (NOT rsEditCust.EOF)) 
%>
<%
strComplaintID = rsEditCust.Fields.Item("ComplaintID").Value
strCustID = rsEditCust.Fields.Item("CustomerID").Value
if strLastID <> strCustID then
%>
  <tr>
    <td><center><%=strComplaintID%> - <%=strCustID%></center></td>
    <td><a href="javascript:;" onClick="MM_openBrWindow('custinfo.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "CustomerID=" & rsEditCust.Fields.Item("CustomerID").Value %>','','scrollbars=yes,width=520,height=520')"><%=(rsEditCust.Fields.Item("CustomerFullName").Value)%></a></td>
      <td><% If (rsEditCust.Fields.Item("Status").Value) = True  Then %>
          <font color="#FF0000"><center>Closed</center></font>
          <% Else %>
          <font color="#008000"><center>Open</center></font>
          <% End If %>
      <td><div align="center"><a href="actdet.asp?<%= Server.HTMLEncode(MM_keepBoth) & MM_joinChar(MM_keepBoth) & "CustomerID=" & rsEditCust.Fields.Item("CustomerID").Value %>">Action details</a></div></td>
      <td><a href="actnew.asp"><center>Add action</center> </td>
</tr>
<%
end if
strLastID = strCustID
%>
<% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsEditCust.MoveNext()
Wend
%>

Cheech

[Peace][Pipe]
 
Cheech,

just got back to working on this problem, tried the above and still couldnt get it to work. created another recordset on the page to include the action Closed field and placed this in my table as a hidden field, changed the code as follows but still not getting anywhere

<% If (Recordest1.Fields.Item("ActionClosed").Value)=True Then%>
(rsEditCust.Fields.Item("Status").Value) = Closed")
<% End If %>

can you offer any further help at all?
 
<%
strStatus = Recordest1.Fields.Item("ActionClosed").Value
if strStatus="True" Then strStatus = "Closed"
End If
%>


[Peace][Pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top