Hello everyone. I am trying to build a inventory and pos software with vb 6.0 and MS-Access as database. In one of my form I have the following code to call my inventory of a certain invoice number to print tag for my products. I am using a MSHFlexgrid with 4 columns. Everything seems ok but when I run the code the column heading of the grid changed to the heading of my database column, I just want the data of those column not the heading. Here is the code :
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\main.mdb;Persist Security Info=False"
cn.Open
Set rs = New ADODB.Recordset
rs.Open ("Select code,tprice,quantity from tblstock where inv_no like '" & cmbinvno.Text & "' and inv_date like '" & cmbinvdate.Text & "'"), cn, adOpenStatic, adLockOptimistic
With Grid
Set Grid.DataSource = rs
If .Rows = 2 And .TextMatrix(1, 3) = "" Then
.TextMatrix(1, 1) = rs!code
.TextMatrix(1, 2) = rs!tprice
.TextMatrix(1, 3) = rs!Quantity
Else
.Rows = .Rows + 1
.TextMatrix(.Rows - 1, 1) = rs!code
.TextMatrix(.Rows - 1, 2) = rs!tprice
.TextMatrix(.Rows - 1, 3) = rs!Quantity
.Rows = .Rows - 1
End If
End With
I don't have any idea what I am doing wrong or how can I overcome this situation. Please help.