How to display this problem in MSHFlexgrid?
I have 2 tables,
1st table:ITEM(ITEM_NO, ITEM_NAME, ITEM_SIZE, ITEM_QHAND, ITEM_RPRICE)
2nd table: STRUCTURE(STR_ITEMNO, STR_FLOWER, STR_QTY)
and i wanna display the STR_ITEMNO, ITEM_NAME, STR_QTY
BUT NOTE: ITEM_NAME WILL DEPEND ON THE STR_ITEMNO BECAUSE ITEMNO IS A FOREIGN KEY...
HERE IS MY CODE IN POPULATE FUNCTION
Code:
Dim rs As New ADODB.Recordset
Dim sqlStr As String
sqlStr = "Select STR_ITEMNO,ITEM_NAME,STR_QTY from STRUCTURE,ITEM "
rs.Open sqlStr, Conn, adOpenForwardOnly, adLockReadOnly
If Not rs.EOF Then
MSHItemStructure.FixedCols = 0
Set MSHItemStructure.Recordset = rs
With MSHItemStructure
FormatString = "ITEM NUMBER|FLOWER ID|QUANTITY"
.ColWidth(0) = 1450
.ColWidth(1) = 2200
.ColWidth(2) = 1300
.AllowUserResizing = flexResizeColumns
.SelectionMode = flexSelectionByRow
End With
MSHItemStructure.Enabled = True
Else
MSHItemStructure.FixedCols = 0
With MSHItemStructure
FormatString = "ITEM NUMBER|FLOWER ID|QUANTITY"
.ColWidth(0) = 1000
.ColWidth(1) = 1000
.ColWidth(2) = 1000
' MSHItemStructure.TextMatrix(1, 0) = ""
' MSHItemStructure.TextMatrix(1, 1) = ""
' MSHItemStructure.TextMatrix(1, 2) = ""
End With
MSHItemStructure.Enabled = False
End If
Re: How to display this problem in MSHFlexgrid?
Research the SQL Join clauses.
In this case the SQL would be
Select STR_ITEMNO,ITEM_NAME,STR_QTY
From STRUCTURE Inner Join ITEM On Structure.str_ItemNo = Item.Item_No