I have created 2 flexgrids. One is called Customer, the other is called Invoices. I wrote some code that displays each in their own flex grid and as you navigate up or down on the customer grid (Parent) it shows you invoices for that customer in the invoice grid (Child)
The code I used is like this:
StrSql = "SHAPE {select CustId,LastName,FirstName,HomeTel,WorkTel,WorkExt,Address,City,Zip,Area " & _
"from Customers " & _
"where LastName = """ + maskSrch(atab).Text + """ " & _
"order by LastName} AS ParentCMD " & _
"APPEND ({select AmtBal,AmtGrand,AmtPymtTot,AmtSTax,AmtSub,CustId,datein,EmpId,jobnum,Notes,status,Store " & _
"from Invoices " & _
"Order by CustId } AS ChildCMD RELATE CustId TO CustId) AS ChildCMD"
Set rsBrowse = New ADODB.Recordset
rsBrowse.Open StrSql, dbCTS, adOpenStatic, adLockOptimistic
Set fMainForm.gridBrowse(0).DataSource = rsBrowse 'This is the customer grid
Set fMainForm.gridBrowse(1).DataSource = rsBrowse("ChildCMD"
.UnderlyingValue 'This is the invoice grid
The problem that I am having is that the Invoice grid(childCMD) displays correctly but the Customer grid (Parent) shows the fields selected for the customer and then if you move your cursor to the right to look at the cells once it passes the last cell specified by the parentCMD it then displays the fields for the invoice grid. In other words, the customer grid is mixed with data from the customer and invoice fields. Invoice data is tagged into the end of the grid. Is there a way to make this not happen?
Thanks,
Dan
The code I used is like this:
StrSql = "SHAPE {select CustId,LastName,FirstName,HomeTel,WorkTel,WorkExt,Address,City,Zip,Area " & _
"from Customers " & _
"where LastName = """ + maskSrch(atab).Text + """ " & _
"order by LastName} AS ParentCMD " & _
"APPEND ({select AmtBal,AmtGrand,AmtPymtTot,AmtSTax,AmtSub,CustId,datein,EmpId,jobnum,Notes,status,Store " & _
"from Invoices " & _
"Order by CustId } AS ChildCMD RELATE CustId TO CustId) AS ChildCMD"
Set rsBrowse = New ADODB.Recordset
rsBrowse.Open StrSql, dbCTS, adOpenStatic, adLockOptimistic
Set fMainForm.gridBrowse(0).DataSource = rsBrowse 'This is the customer grid
Set fMainForm.gridBrowse(1).DataSource = rsBrowse("ChildCMD"

The problem that I am having is that the Invoice grid(childCMD) displays correctly but the Customer grid (Parent) shows the fields selected for the customer and then if you move your cursor to the right to look at the cells once it passes the last cell specified by the parentCMD it then displays the fields for the invoice grid. In other words, the customer grid is mixed with data from the customer and invoice fields. Invoice data is tagged into the end of the grid. Is there a way to make this not happen?
Thanks,
Dan