HI everyone
i am trying to write POS and Inventory for myself in vb6. I am stuck and gone blank what to do. here is what i want to do.
search database for the stocks.
change the caption of the button ( eg caption of the botton is "COKE 250ml" and i want it to change to "COKE 250ml [30]" now [30] is the number of coke in stock.
Private Function FindButtonName()
Dim strTest As String
Dim strArray() As String
Dim intCount As Integer
Dim strButtonName As String
Dim rsDiscriptionFind As ADODB.Recordset
Set rsDiscriptionFind = New ADODB.Recordset
rsDiscriptionFind.Open "Stocks", gobjConn, adOpenDynamic, adLockPessimistic
rsDiscriptionFind.Filter = "Discription='" & strIC & "'"
strTest = strIC
strArray = Split(strTest, " ")
For intCount = LBound(strArray) To UBound(strArray)
Trim (strArray(intCount))
Next
If intCount = "1" Then
strButtonName = "Cmd" & strArray(0)
ElseIf intCount = "2" Then
strButtonName = "Cmd" & strArray(0) & strArray(1)
ElseIf intCount = "3" Then
strButtonName = "Cmd" & strArray(0) & strArray(1) & strArray(2)
ElseIf intCount = "4" Then
strButtonName = "Cmd" & strArray(0) & strArray(1) & strArray(2) & strArray(3)
Else
strButtonName = "Cmd" & strArray(0) & strArray(1) & strArray(2) & strArray(3) & strArray(4)
End If
' "FrmGraphicMenu.'" & strButtonName & .Caption&"'" = "test" 'this is not working
End Function
Private Sub Command7_Click()
InitializeDB
Dim rsStChk As New ADODB.Recordset
Set rsStChk = New ADODB.Recordset
rsStChk.Open "Stocks", gobjConn, adOpenDynamic, adLockPessimistic
Dim rsSearchStock As ADODB.Recordset
Set rsSearchStock = New ADODB.Recordset
rsSearchStock.Open "Stocks", gobjConn, adOpenDynamic, adLockPessimistic
Do Until rsSearchStock.EOF = True
strIC = rsSearchStock!Discription
MsgBox strIC
Call FindButtonName
rsSearchStock.MoveNext
Loop
End Sub
it is in loop and i want all the buttons get their quantities updated after every sale entery.
thank you in advance