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!

display related table info also

Status
Not open for further replies.

frogjumps

IS-IT--Management
Aug 10, 2001
14
US
I have 2 tables in Access, 1 customers, 1 notes. these are related by customer can have many notes.

I cannot get the notes to display for each customer. It displays ALL notes for ALL customers, instaed of just the notes for displayed customer.

here's the code:

<%@LANGUAGE=&quot;VBSCRIPT&quot;%>
<!--#include file=&quot;Connections/cnDH.asp&quot; -->
<%
set rsCust = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsCust.ActiveConnection = MM_cnDH_STRING
rsCust.Source = &quot;SELECT Customers.CustID, Customers.CompanyName, Customers.ContactFirstName, Customers.ContactLastName, Customers.Address, Customers.Address2, Customers.Address3, Customers.City, Customers.State, Customers.ZipCode, Customers.PhoneNumber, Customers.FaxNumber, Customers.AltPhone, Notes.TaskID, Notes.nCustID, Notes.Employee, Notes.Time, Notes.Date, Notes.Notes FROM Customers LEFT OUTER JOIN Notes ON (Notes.nCustID = Customers.CustID)&quot;
rsCust.CursorType = 0
rsCust.CursorLocation = 2
rsCust.LockType = 3
rsCust.Open()
rsCust_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = 1
Dim Repeat1__index
Repeat1__index = 0
rsCust_numRows = rsCust_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

' set the record count
rsCust_total = rsCust.RecordCount

' set the number of rows displayed on this page
If (rsCust_numRows < 0) Then
rsCust_numRows = rsCust_total
Elseif (rsCust_numRows = 0) Then
rsCust_numRows = 1
End If

' set the first and last displayed record
rsCust_first = 1
rsCust_last = rsCust_first + rsCust_numRows - 1

' if we have the correct record count, check the other stats
If (rsCust_total <> -1) Then
If (rsCust_first > rsCust_total) Then rsCust_first = rsCust_total
If (rsCust_last > rsCust_total) Then rsCust_last = rsCust_total
If (rsCust_numRows > rsCust_total) Then rsCust_numRows = rsCust_total
End If
%>
<%
' *** Move To Record and Go To Record: declare variables

Set MM_rs = rsCust
MM_rsCount = rsCust_total
MM_size = rsCust_numRows
MM_uniqueCol = &quot;&quot;
MM_paramName = &quot;&quot;
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> &quot;&quot;) Then
MM_paramIsDefined = (Request.QueryString(MM_paramName) <> &quot;&quot;)
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter

if (Not MM_paramIsDefined And MM_rsCount <> 0) then

' use index parameter if defined, otherwise use offset parameter
r = Request.QueryString(&quot;index&quot;)
If r = &quot;&quot; Then r = Request.QueryString(&quot;offset&quot;)
If r <> &quot;&quot; Then MM_offset = Int(r)

' if we have a record count, check if we are past the end of the recordset
If (MM_rsCount <> -1) Then
If (MM_offset >= MM_rsCount Or MM_offset = -1) Then ' past end or move last
If ((MM_rsCount Mod MM_size) > 0) Then ' last page not a full repeat region
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If

' move the cursor to the selected record
i = 0
While ((Not MM_rs.EOF) And (i < MM_offset Or MM_offset = -1))
MM_rs.MoveNext
i = i + 1
Wend
If (MM_rs.EOF) Then MM_offset = i ' set MM_offset to the last possible record

End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range

If (MM_rsCount = -1) Then

' walk to the end of the display range for this page
i = MM_offset
While (Not MM_rs.EOF And (MM_size < 0 Or i < MM_offset + MM_size))
MM_rs.MoveNext
i = i + 1
Wend

' if we walked off the end of the recordset, set MM_rsCount and MM_size
If (MM_rs.EOF) Then
MM_rsCount = i
If (MM_size < 0 Or MM_size > MM_rsCount) Then MM_size = MM_rsCount
End If

' if we walked off the end, set the offset based on page size
If (MM_rs.EOF And Not MM_paramIsDefined) Then
If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
If ((MM_rsCount Mod MM_size) > 0) Then
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If

' reset the cursor to the beginning
If (MM_rs.CursorType > 0) Then
MM_rs.MoveFirst
Else
MM_rs.Requery
End If

' move the cursor to the selected record
i = 0
While (Not MM_rs.EOF And i < MM_offset)
MM_rs.MoveNext
i = i + 1
Wend
End If
%>
<%
' *** Move To Record: update recordset stats

' set the first and last displayed record
rsCust_first = MM_offset + 1
rsCust_last = MM_offset + MM_size
If (MM_rsCount <> -1) Then
If (rsCust_first > MM_rsCount) Then rsCust_first = MM_rsCount
If (rsCust_last > MM_rsCount) Then rsCust_last = MM_rsCount
End If

' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

' create the list of parameters which should not be maintained
MM_removeList = &quot;&index=&quot;
If (MM_paramName <> &quot;&quot;) Then MM_removeList = MM_removeList & &quot;&&quot; & MM_paramName & &quot;=&quot;
MM_keepURL=&quot;&quot;:MM_keepForm=&quot;&quot;:MM_keepBoth=&quot;&quot;:MM_keepNone=&quot;&quot;

' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
NextItem = &quot;&&quot; & Item & &quot;=&quot;
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
End If
Next

' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
NextItem = &quot;&&quot; & Item & &quot;=&quot;
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> &quot;&quot;) Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> &quot;&quot;) Then MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> &quot;&quot;) Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> &quot;&quot;) Then
MM_joinChar = &quot;&&quot;
Else
MM_joinChar = &quot;&quot;
End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links

MM_keepMove = MM_keepBoth
MM_moveParam = &quot;index&quot;

' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 0) Then
MM_moveParam = &quot;offset&quot;
If (MM_keepMove <> &quot;&quot;) Then
params = Split(MM_keepMove, &quot;&&quot;)
MM_keepMove = &quot;&quot;
For i = 0 To UBound(params)
nextItem = Left(params(i), InStr(params(i),&quot;=&quot;) - 1)
If (StrComp(nextItem,MM_moveParam,1) <> 0) Then
MM_keepMove = MM_keepMove & &quot;&&quot; & params(i)
End If
Next
If (MM_keepMove <> &quot;&quot;) Then
MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
End If
End If
End If

' set the strings for the move to links
If (MM_keepMove <> &quot;&quot;) Then MM_keepMove = MM_keepMove & &quot;&&quot;
urlStr = Request.ServerVariables(&quot;URL&quot;) & &quot;?&quot; & MM_keepMove & MM_moveParam & &quot;=&quot;
MM_moveFirst = urlStr & &quot;0&quot;
MM_moveLast = urlStr & &quot;-1&quot;
MM_moveNext = urlStr & Cstr(MM_offset + MM_size)
prev = MM_offset - MM_size
If (prev < 0) Then prev = 0
MM_movePrev = urlStr & Cstr(prev)
%>
<html>
<head>
<title>The Direct Hit</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<script language=&quot;JavaScript&quot;>
<!--
function GP_AdvOpenWindow(theURL,winName,features,popWidth,popHeight,winAlign,ignorelink,alwaysOnTop,autoCloseTime,borderless) { //v2.0
var leftPos=0,topPos=0,autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;
if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
if (winAlign && winAlign != &quot;&quot; && popWidth > 0 && popHeight > 0) {
if (document.all || document.layers || document.getElementById) {w = screen.availWidth; h = screen.availHeight;}
if (winAlign.indexOf(&quot;center&quot;) != -1) {topPos = (h-popHeight)/2;leftPos = (w-popWidth)/2;}
if (winAlign.indexOf(&quot;bottom&quot;) != -1) topPos = h-popHeight; if (winAlign.indexOf(&quot;right&quot;) != -1) leftPos = w-popWidth;
if (winAlign.indexOf(&quot;left&quot;) != -1) leftPos = 0; if (winAlign.indexOf(&quot;top&quot;) != -1) topPos = 0;
features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;}
if (document.all && borderless && borderless != &quot;&quot; && features.indexOf(&quot;fullscreen&quot;) != -1) features+=&quot;,fullscreen=1&quot;;
if (window[&quot;popupWindow&quot;] == null) window[&quot;popupWindow&quot;] = new Array();
var wp = popupWindow.length;
popupWindow[wp] = window.open(theURL,winName,features);
if (popupWindow[wp].opener == null) popupWindow[wp].opener = self;
if (document.all || document.layers || document.getElementById) {
if (borderless && borderless != &quot;&quot;) {popupWindow[wp].resizeTo(popWidth,popHeight); popupWindow[wp].moveTo(leftPos, topPos);}
if (alwaysOnTop && alwaysOnTop != &quot;&quot;) {
ontopIntervalHandle = popupWindow[wp].setInterval(&quot;window.focus();&quot;, 50);
popupWindow[wp].document.body.onload = function() {window.setInterval(&quot;window.focus();&quot;, 50);}; }
if (autoCloseTime && autoCloseTime > 0) {
popupWindow[wp].document.body.onbeforeunload = function() {
if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
window.onbeforeunload = null; }
autoCloseTimeoutHandle = window.setTimeout(&quot;popupWindow[&quot;+wp+&quot;].close()&quot;, autoCloseTime * 1000); }
window.onbeforeunload = function() {for (var i=0;i<popupWindow.length;i++) popupWindow.close();}; }
document.MM_returnValue = (ignorelink && ignorelink != &quot;&quot;) ? false : true;
}
//-->
</script>
</head>
<body text=&quot;#000000&quot; link=&quot;#0000FF&quot; vlink=&quot;#FF0000&quot; alink=&quot;#FFFF00&quot; bgcolor=&quot;#FFFFFF&quot;>
<font face=&quot;Tahoma&quot;><font face=&quot;Tahoma&quot;><font size=&quot;2&quot;> <font color=&quot;#333333&quot;><br>
<br>
</font></font><font size=&quot;2&quot; color=&quot;#333333&quot;> <A HREF=&quot;<%=MM_moveFirst%>&quot;>First</A>
| <A HREF=&quot;<%=MM_moveNext%>&quot;>Next</A>
| <A HREF=&quot;<%=MM_movePrev%>&quot;>Previous</A>
| <A HREF=&quot;<%=MM_moveLast%>&quot;>Last</A><br>
</font><font face=&quot;Tahoma&quot; color=&quot;#333333&quot;></font></font></font>
<form name=&quot;Form1&quot; action=&quot;/modify.asp&quot; method=&quot;POST&quot;>
<font face=&quot;Tahoma&quot;><font face=&quot;Tahoma&quot;><font face=&quot;Tahoma&quot; color=&quot;#333333&quot;><font size=&quot;2&quot;><A HREF=&quot;/modify.asp?<%= MM_keepURL & MM_joinChar(MM_keepURL) & &quot;CustID=&quot; & rsCust.Fields.Item(&quot;CustID&quot;).Value %>&quot;>Modify
Record</A></font> <font size=&quot;2&quot;>| <A HREF=&quot;/insert.asp?<%= MM_keepURL & MM_joinChar(MM_keepURL) & &quot;CustID=&quot; & rsCust.Fields.Item(&quot;CustID&quot;).Value %>&quot;>Insert
New Record</A> | <A HREF=&quot;/delete.asp?<%= MM_keepURL & MM_joinChar(MM_keepURL) & &quot;CustID=&quot; & rsCust.Fields.Item(&quot;CustID&quot;).Value %>&quot;>Delete
Current Record</A> |</font> <font size=&quot;2&quot;>Schedule Call | Invoice | </font></font></font></font>
<br>
<br>
<table border=&quot;0&quot; width=&quot;797&quot;>
<tr>
<td align=&quot;right&quot; width=&quot;113&quot;>
<div align=&quot;left&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;>Customer
#</font></div>
</td>
<td colspan=&quot;2&quot;><font size=&quot;2.5&quot; color=&quot;#000000&quot; face=&quot;Tahoma&quot;><%=(rsCust.Fields.Item(&quot;CustID&quot;).Value)%></font></td>
<td width=&quot;99&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;>Address</font></td>
<td width=&quot;356&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;><%=(rsCust.Fields.Item(&quot;Address&quot;).Value)%></font></td>
</tr>
<tr>
<td align=&quot;right&quot; width=&quot;113&quot;>
<div align=&quot;left&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;>Customer's
Name</font></div>
</td>
<td colspan=&quot;2&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;><%=(rsCust.Fields.Item(&quot;CompanyName&quot;).Value)%></font></td>
<td width=&quot;99&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;>Address line
2</font></td>
<td width=&quot;356&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;><%=(rsCust.Fields.Item(&quot;Address2&quot;).Value)%></font></td>
</tr>
<tr>
<td align=&quot;right&quot; width=&quot;113&quot;>
<div align=&quot;left&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;>Contact</font></div>
</td>
<td colspan=&quot;2&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;><%=(rsCust.Fields.Item(&quot;ContactFirstName&quot;).Value)%><%=(rsCust.Fields.Item(&quot;ContactLastName&quot;).Value)%></font></td>
<td width=&quot;99&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;>Address line
3</font></td>
<td width=&quot;356&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;><%=(rsCust.Fields.Item(&quot;Address3&quot;).Value)%></font></td>
</tr>
<tr>
<td align=&quot;right&quot; width=&quot;113&quot;>
<div align=&quot;left&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;>Alternate
Contact</font></div>
</td>
<td colspan=&quot;2&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;></font></td>
<td width=&quot;99&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;>City</font></td>
<td width=&quot;356&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;><%=(rsCust.Fields.Item(&quot;City&quot;).Value)%></font></td>
</tr>
<tr>
<td align=&quot;right&quot; width=&quot;113&quot;>
<div align=&quot;left&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;>Phone
#</font></div>
</td>
<td colspan=&quot;2&quot;> <font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;><%=(rsCust.Fields.Item(&quot;PhoneNumber&quot;).Value)%></font></td>
<td width=&quot;99&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;>State</font></td>
<td width=&quot;356&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;><%=(rsCust.Fields.Item(&quot;State&quot;).Value)%></font></td>
</tr>
<tr>
<td align=&quot;right&quot; width=&quot;113&quot;>
<div align=&quot;left&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;>Alternate
Phone #</font></div>
</td>
<td colspan=&quot;2&quot;> <font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;><%=(rsCust.Fields.Item(&quot;AltPhone&quot;).Value)%></font></td>
<td width=&quot;99&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;>Zip Code</font></td>
<td width=&quot;356&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;><%=(rsCust.Fields.Item(&quot;ZipCode&quot;).Value)%></font></td>
</tr>
<tr>
<td align=&quot;right&quot; width=&quot;113&quot;>
<div align=&quot;left&quot;><font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;>Fax #</font></div>
</td>
<td colspan=&quot;2&quot;> <font face=&quot;Tahoma&quot; color=&quot;#000000&quot; size=&quot;2.5&quot;><%=(rsCust.Fields.Item(&quot;FaxNumber&quot;).Value)%></font></td>
<td width=&quot;99&quot;><font color=&quot;#000000&quot; face=&quot;Tahoma&quot; size=&quot;2.5&quot;>eMail</font></td>
<td width=&quot;356&quot;><font color=&quot;#000000&quot; size=&quot;2.5&quot; face=&quot;Tahoma&quot;></font></td>
</tr>
</table>
<font face=&quot;Tahoma&quot; color=&quot;#333333&quot;><br>
</font> <font face=&quot;Tahoma&quot; size=&quot;2&quot;><font color=&quot;#333333&quot;>| <font color=&quot;#0000CC&quot; onClick=&quot;GP_AdvOpenWindow('/ins_note.asp?<%= MM_keepURL & MM_joinChar(MM_keepURL) & &quot;CustID=&quot; & rsCust.Fields.Item(&quot;CustID&quot;).Value %>','InsertNote','fullscreen=no,toolbar=no,location=no,status=no,menubar=yes,scrollbars=no,resizable=yes',400,300,'center','','',0,'');return document.MM_returnValue&quot;>Insert
Note</font> |</font> Activities | Quote | Invoice |</font><font face=&quot;Tahoma&quot; size=&quot;2&quot;></font><font face=&quot;Tahoma&quot; size=&quot;2&quot;></font>
</form>
<font face=&quot;Tahoma&quot; size=&quot;4&quot;> <font size=&quot;2&quot;>Account History</font></font><font face=&quot;Tahoma&quot; size=&quot;2&quot;>
</font><font face=&quot;Tahoma&quot; size=&quot;2&quot;><br>
</font>
<table width=&quot;73%&quot; border=&quot;0&quot;>
<tr bgcolor=&quot;#66CCFF&quot;>
<td width=&quot;10%&quot;><i><font face=&quot;Tahoma&quot; size=&quot;2.5&quot;>Date</font></i></td>
<td width=&quot;10%&quot;><i><font face=&quot;Tahoma&quot; size=&quot;2.5&quot;>Time</font></i></td>
<td width=&quot;52%&quot;><i><font face=&quot;Tahoma&quot; size=&quot;2.5&quot;>Notes</font></i></td>
<td width=&quot;14%&quot;><i><font face=&quot;Tahoma&quot; size=&quot;2.5&quot;>Salesman</font></i></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsCust.EOF))
%>
<%If (Repeat1__numRows Mod 2) Then%>
<tr bgcolor=&quot;#CCCCCC&quot;>
<%Else%>
<tr bgcolor=&quot;#FFFFFF&quot;>
<%End If%>
<td width=&quot;10%&quot;><font face=&quot;Tahoma&quot; size=&quot;2&quot; color=&quot;#000000&quot;><%=(rsCust.Fields.Item(&quot;Date&quot;).Value)%></font></td>
<td width=&quot;10%&quot;><font face=&quot;Tahoma&quot; size=&quot;2&quot; color=&quot;#000000&quot;><%=(rsCust.Fields.Item(&quot;Time&quot;).Value)%></font></td>
<td width=&quot;52%&quot;><font face=&quot;Tahoma&quot; size=&quot;2&quot; color=&quot;#000000&quot;><%=(rsCust.Fields.Item(&quot;Notes&quot;).Value)%></font></td>
<td width=&quot;14%&quot;><font face=&quot;Tahoma&quot; size=&quot;2&quot; color=&quot;#000000&quot;><%=(rsCust.Fields.Item(&quot;Employee&quot;).Value)%></font></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsCust.MoveNext()
Wend
%>
</table>
</body>
</html>
<%
rsCust.Close()
%>
FrOg 8)
 
Hi

I know we normally ask for more code from people but ...

Look, you are establishing a relationship between your two tables with your JOIN, but you are not then filtering the data. You need to add a &quot;WHERE customers.custID=&quot; clause to filter your recordset.

Also, with your join, try

Code:
FROM Customers LEFT JOIN Notes ON (Customers.nCustID = Notes.CustID)

The order that the relationship is specified can be cruicial. Derren
[The only person in the world to like Word]
 
as far as filtering the rs notes, how would I do this...

as for the WHERE clause, I need to return ALL records and the associated Notes related to these records (if any).

Why should I use the Left Join, instead of the Left Outer Join?

FrOg 8)
 
If you are not after all notes and just require the notes relating to one specific customer you need to &quot;filter&quot; the records. Sorry about that, but this is just a term used for only showing the records you require. To do this you just need to use the WHERE clause of the SQL. This is in addition to the join which you have already set up which will return every related record.

As far as your join goes, your join may still work, try the where clause first

You just need to change your SQL to

Code:
FROM Customers LEFT OUTER JOIN Notes ON (Notes.nCustID = Customers.CustID) WHERE customers.custid=&quot; & valueof customeridyouwant&quot;
 Derren
[The only person in the world to like Word]
 
this :

WHERE customers.custid=&quot; & valueof customeridyouwant&quot;

How could I change this to the currently displayed record? or the current rs returned CustID value?

FrOg 8)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top