hello everybody,
i have a private sub in my program displays data of a table in an mshflexgrid calling it flxResults. Well, in many forms the flxResults displays data of different tables for example in frmOrdDtlsAllRcs in the flxResults i display the OrderDetails table's records, in frmCustSrchResults i display the customers search results according to user's criteria etc. In column headers of flexResults, i don't display the field names of the associated table, i don't like it and i display with greek names the column headers and this for appearance reasons.
Well, i want to create a public sub ColHeadrs in my module, i don't know exactly how will be and that's i need your help, i want something like
public sub ColHeadears (arguments if nessacary)
if condition1 then
displaying the column headers with greek names for OrderDetails table
elseif condition2 then
displaying the column headers with greek names for customers table
elseif condition3 then
etc..
end if
end sub
I am looking for the condition to do this because
i can't think something about this, i know how to display the column headers with greek names. Any ideas please?
For additional help, just an example of displayData looks.
This sub displays the data in the flxResults grid
concretely the orderDetails records for the order displayed.
Public Sub displayData()
sum = 0
sql = "select * from orderDetails " & _
"where (orderID='" & AdoOrd.Recordset!OrderID & "');"
Set rsOrdDet = New ADODB.Recordset
rsOrdDet.CursorLocation = adUseClient
rsOrdDet.Open sql, conn, adOpenStatic, adLockOptimistic
' Make room for column widths.
num_cols = rsOrdDet.Fields.Count - 1
ReDim col_wid(0 To num_cols - 1)
' Set column headers.
flxResults.Rows = 2
flxResults.cols = num_cols
flxResults.FixedCols = 0
flxResults.FixedRows = 1
'here i want to call the ColHeadrs sub to display
'the properly headers for the table i display the data
r = 0
' Display the data.
Do Until rsOrdDet.EOF
r = r + 1
flxResults.Rows = r + 1
For c = 1 To rsOrdDet.Fields.Count - 1
flxResults.TextMatrix(r, c - 1) = rsOrdDet.Fields(c).Value
' See if we need to enlarge the column.
new_wid = TextWidth(rsOrdDet.Fields(c - 1).Value)
If col_wid(c - 1) < new_wid Then col_wid(c - 1) = _
new_wid
Next c
rsOrdDet.MoveNext
Loop
' Set the grid's column widths.
For c = 0 To num_cols - 1
flxResults.ColWidth(c) = col_wid(c) + 1500
Next
'calculates the sumprice of products by order
rsOrdDet.MoveFirst
Do Until rsOrdDet.EOF
sum = sum + rsOrdDet!ProdSumPrice
rsOrdDet.MoveNext
Loop
SumPriceTxt.Text = sum
rsOrdDet.Close
End Sub
Any help with be much appreciated
Thank you in advanced.
i have a private sub in my program displays data of a table in an mshflexgrid calling it flxResults. Well, in many forms the flxResults displays data of different tables for example in frmOrdDtlsAllRcs in the flxResults i display the OrderDetails table's records, in frmCustSrchResults i display the customers search results according to user's criteria etc. In column headers of flexResults, i don't display the field names of the associated table, i don't like it and i display with greek names the column headers and this for appearance reasons.
Well, i want to create a public sub ColHeadrs in my module, i don't know exactly how will be and that's i need your help, i want something like
public sub ColHeadears (arguments if nessacary)
if condition1 then
displaying the column headers with greek names for OrderDetails table
elseif condition2 then
displaying the column headers with greek names for customers table
elseif condition3 then
etc..
end if
end sub
I am looking for the condition to do this because
i can't think something about this, i know how to display the column headers with greek names. Any ideas please?
For additional help, just an example of displayData looks.
This sub displays the data in the flxResults grid
concretely the orderDetails records for the order displayed.
Public Sub displayData()
sum = 0
sql = "select * from orderDetails " & _
"where (orderID='" & AdoOrd.Recordset!OrderID & "');"
Set rsOrdDet = New ADODB.Recordset
rsOrdDet.CursorLocation = adUseClient
rsOrdDet.Open sql, conn, adOpenStatic, adLockOptimistic
' Make room for column widths.
num_cols = rsOrdDet.Fields.Count - 1
ReDim col_wid(0 To num_cols - 1)
' Set column headers.
flxResults.Rows = 2
flxResults.cols = num_cols
flxResults.FixedCols = 0
flxResults.FixedRows = 1
'here i want to call the ColHeadrs sub to display
'the properly headers for the table i display the data
r = 0
' Display the data.
Do Until rsOrdDet.EOF
r = r + 1
flxResults.Rows = r + 1
For c = 1 To rsOrdDet.Fields.Count - 1
flxResults.TextMatrix(r, c - 1) = rsOrdDet.Fields(c).Value
' See if we need to enlarge the column.
new_wid = TextWidth(rsOrdDet.Fields(c - 1).Value)
If col_wid(c - 1) < new_wid Then col_wid(c - 1) = _
new_wid
Next c
rsOrdDet.MoveNext
Loop
' Set the grid's column widths.
For c = 0 To num_cols - 1
flxResults.ColWidth(c) = col_wid(c) + 1500
Next
'calculates the sumprice of products by order
rsOrdDet.MoveFirst
Do Until rsOrdDet.EOF
sum = sum + rsOrdDet!ProdSumPrice
rsOrdDet.MoveNext
Loop
SumPriceTxt.Text = sum
rsOrdDet.Close
End Sub
Any help with be much appreciated
Thank you in advanced.