I have an .mdb database with the tables as laid out below. The Main Table has a list of Groups where there can be any number ("N") of groups. In the groups are subgroupings (as noted by the number after the dash). Each subgroup has any number of Items in the subgroup (see the "ItemNO" field). In excel (see VBA Code below), I am able to import the database using the DAO object reference and sort the data into a matrix (see below also). In that matrix, I can edit the values in the cells and then, using transaction, update the database with the altered values.
I'd like to do this using VB6 for a stand-alone version and not have to rely on the excel backbone. I'm pretty good with excel VBA but am a hobbyist when it comes to VB6 with no knowledge of the datagrid nor flexgrid. I am able to use the datasource properties of these controls to add the data to my program but I need the ability to manipulate the data into the matrix to organize the data better much like I do in excel.
What would be a good way to this? Is datagrid or flexgrid the way to go? Is there a way to use the datagrid or flexgrid like excel? I'm not looking for a fully coded solution just some pointers in the right direction (although some code or quasi-code might help ).
Any suggestions or input are greatly appreciated!
MainTable:
GroupID ItemNO Quantity ItemID
Gr1-10 1 5 ABC1
Gr1-10 2 Q+2 XYZ1
Gr1-20 1 2 ABC2
Gr1-20 2 Q-1 XYZ2
Gr1-30 1 3 ABC3
Gr1-30 2 2 XYZ3
Gr2-20 1 1 QWE2
Gr2-20 2 Q+1 RST5
Gr2-20 3 2 LMN1
Gr3-10 1 Q ABC1
.
.
.
GrN-xx x (Q Value) (ID Value)
NameTable:
GroupID Description
Gr1 Group 1
Gr2 Group 2
Gr3 Group 3
.
.
.
GrN Description of GrN
Matrix in Excel:
GroupID Description SubID10 SubID20 SubID30
Gr1 Group 1 Q+2 Q-1
Gr2 Group 2 Q+1
Gr3 Group 3 Q
********************
What's the best way to get the answers you need?? See FAQ222-2244 for details!
Code:
recarray = rs.GetRows(rs.RecordCount)
For i = 0 To UBound(recarray, 2)
For j = 0 To UBound(recarray, 1)
DataArray(j) = CStr(recarray(j, i))
Next j
'First Determine if it has "Q" Value
If UCase(Left(DataArray(2), 1)) = "Q" Then
If Left(DataArray(0), 3) <> .Cells(RowCount, 1) Then
RowCount = RowCount + 1
.Cells(RowCount, 1) = Left(DataArray(0), 3)
End If
Select Case CStr(Right(RTrim(DataArray(0)), 2))
Case Is = "10"
.Cells(RowCount, 4) = Trim(DataArray(2))
Case Is = "20"
.Cells(RowCount, 5) = Trim(DataArray(2))
Case Is = "30"
.Cells(RowCount, 6) = Trim(DataArray(2))
Case Is = "40"
.Cells(RowCount, 7) = Trim(DataArray(2))
Case Is = "50"
.Cells(RowCount, 8) = Trim(DataArray(2))
Case Is = "60"
.Cells(RowCount, 9) = Trim(DataArray(2))
Case Else
.Cells(RowCount, 10) = .Cells(RowCount, 10) & "Size Error " & DataArray(0) & " "
intErrorCount = intErrorCount + 1
End Select
End If
Next i
I'd like to do this using VB6 for a stand-alone version and not have to rely on the excel backbone. I'm pretty good with excel VBA but am a hobbyist when it comes to VB6 with no knowledge of the datagrid nor flexgrid. I am able to use the datasource properties of these controls to add the data to my program but I need the ability to manipulate the data into the matrix to organize the data better much like I do in excel.
What would be a good way to this? Is datagrid or flexgrid the way to go? Is there a way to use the datagrid or flexgrid like excel? I'm not looking for a fully coded solution just some pointers in the right direction (although some code or quasi-code might help ).
Any suggestions or input are greatly appreciated!
MainTable:
GroupID ItemNO Quantity ItemID
Gr1-10 1 5 ABC1
Gr1-10 2 Q+2 XYZ1
Gr1-20 1 2 ABC2
Gr1-20 2 Q-1 XYZ2
Gr1-30 1 3 ABC3
Gr1-30 2 2 XYZ3
Gr2-20 1 1 QWE2
Gr2-20 2 Q+1 RST5
Gr2-20 3 2 LMN1
Gr3-10 1 Q ABC1
.
.
.
GrN-xx x (Q Value) (ID Value)
NameTable:
GroupID Description
Gr1 Group 1
Gr2 Group 2
Gr3 Group 3
.
.
.
GrN Description of GrN
Matrix in Excel:
GroupID Description SubID10 SubID20 SubID30
Gr1 Group 1 Q+2 Q-1
Gr2 Group 2 Q+1
Gr3 Group 3 Q
********************
What's the best way to get the answers you need?? See FAQ222-2244 for details!