zoiz
Jul 10th, 1999, 07:59 AM
i want to call the unboundadddata event once the dbcombo is selected, i write the following code:
Private Sub DBCombo1_Click(Area As Integer)
Dim db As Database
Dim rst As Recordset
Dim row As Integer
Dim irow As Integer
ReDim Recomm(0 To 2, 0 To 2)
lblItemDesc.Caption = DBCombo1.BoundText
Set db = OpenDatabase("C:\WINDOWS\DESKTOP\adcs\PJ.mdb")
Set rst = db.OpenRecordset("Select [Vendor].[Vendor ID], [Vendor Name], [Vendor Discount] from [Vendor] INNER JOIN [VDetails] ON [VDetails].[Vendor ID] = [Vendor].[Vendor ID] where (([VDetails].[Item ID] = '" & DBCombo1.Text & "') and ([Vendor].[Vendor Discount] between 0.1 and 0.2))", dbOpenDynaset)
If rst.RecordCount 0 Then
Do While row < rst.RecordCount
Recomm(0, row) = rst![Vendor ID]
Recomm(1, row) = rst![Vendor Name]
Recomm(2, row) = rst![Vendor Discount]
row = row + 1
rst.MoveNext
Loop
the problem is when this code completed and all the record data are stored in Recomm Array, i cannot call the unbound event to add these data in the array into the dbgrid (unbound).
can someone please help :< ??
Private Sub DBCombo1_Click(Area As Integer)
Dim db As Database
Dim rst As Recordset
Dim row As Integer
Dim irow As Integer
ReDim Recomm(0 To 2, 0 To 2)
lblItemDesc.Caption = DBCombo1.BoundText
Set db = OpenDatabase("C:\WINDOWS\DESKTOP\adcs\PJ.mdb")
Set rst = db.OpenRecordset("Select [Vendor].[Vendor ID], [Vendor Name], [Vendor Discount] from [Vendor] INNER JOIN [VDetails] ON [VDetails].[Vendor ID] = [Vendor].[Vendor ID] where (([VDetails].[Item ID] = '" & DBCombo1.Text & "') and ([Vendor].[Vendor Discount] between 0.1 and 0.2))", dbOpenDynaset)
If rst.RecordCount 0 Then
Do While row < rst.RecordCount
Recomm(0, row) = rst![Vendor ID]
Recomm(1, row) = rst![Vendor Name]
Recomm(2, row) = rst![Vendor Discount]
row = row + 1
rst.MoveNext
Loop
the problem is when this code completed and all the record data are stored in Recomm Array, i cannot call the unbound event to add these data in the array into the dbgrid (unbound).
can someone please help :< ??