everytime i click my command button may mshflexgrid did not update :(
here's my code
If Text1.Text = "" Then
MsgBox "Please Input the Product Code", vbInformation
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "Please Input the Product Unit", vbInformation
Text2.SetFocus
Exit Sub
ElseIf Text3.Text = "" Then
MsgBox "Please Input the Product Quantity", vbInformation
Text3.SetFocus
Exit Sub
ElseIf Text4.Text = "" Then
MsgBox "Please Input the Product Price", vbInformation
Text4.SetFocus
Exit Sub
Else
Dim s
s = "Insert Into temp2 (pcode, unit, quantity, price) VALUES ('" + Text1.Text + "','" + Text2.Text + "','" + Text3.Text + "','" + Text4.Text + "')"
cn.Execute s, adExecuteNoRecords
Call grd_Data_Loader
If Label1.Caption = "0.00" Then
Dim v
v = Val(Text3.Text) * Val(Text4.Text)
Label1.Caption = Format(v, "0.00")
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Combo1.Text = ""
ElseIf Not Label1.Caption = "0.00" Then
Dim t
t = Val(Text3.Text) * Val(Text4.Text) + Label1.Caption
Label1.Caption = Format(t, "0.00")
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Combo1.Text = ""
End If
End If
and this is my code in my mshflexgrid
Private Function grd_Data_Loader()
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\Desktop\Inventory System\PharmacyInventory.mdb;Jet OLEDB:System Database=system.mdw;", "admin", ""
Set rs = New ADODB.Recordset
rs.Open "Select * from temp2", cn, adOpenKeyset, adLockPessimistic
Set MSHFlexGrid1.DataSource = rs
Set rs = Nothing
End Function
help :)