Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

vb6 and barcode

Status
Not open for further replies.

silent_thunder

New Member
i have here already a barcode reader..
then i also have vb6 program connected to ms access2003..i tried to store info to database though vb6 and i made it...
my question is this, how can i use the barcode reader to search the information stored in ms access database?
 
Open a database,
Code:
    Set MyDB = OpenDatabase("c:\my documents\test.mdb")
Then use it,
Code:
Sub updateSoldTo(offset As Integer)
    SQL$ = "SELECT DISTINCTROW Car.MAKE, Car.MODEL, Car.YEAR, " _
    & "Car.StockNo, Car.DispatchDate, soldto.SoldCustID, " _
    & "Car.SoldPrice, Car.SoldDate " _
    & "FROM Car INNER JOIN soldto ON Car.StockNo = soldto.SoldStockNo " _
    & "Where ((soldto.soldCustID) = " & Format$(MyCustID, "###0") & ")" _
    & "ORDER BY Car.DispatchDate DESC;"
    
    Set MyRST = MyDB.OpenRecordset(SQL$)
    If MyRST.RecordCount <> 0 Then
        With MyRST
            SMake.Text = !make
            Smodel.Text = !model
            SYear.Text = !Year
            SStockNo.Text = !StockNo
            SSoldDate.Text = Format(!SoldDate, "dd mmm yy")
            If IsDate(!dispatchdate) Then
                SDispatchDate.Text = !dispatchdate
            Else
                SDispatchDate.Text = ""
            End If
            SPrice.Text = "£" & !soldPrice
        End With
    Else
        SMake.Text = ""
        Smodel.Text = ""
        SYear.Text = ""
        SStockNo.Text = ""
        SPrice.Text = ""
        SSoldDate.Text = ""
        SDispatchDate.Text = ""
    End If
    MyRST.Close
End Sub

The above is copied straight from a VB6 project from many years ago and is probably badly written but it should get you started.

Mike.
 
..thnks for the efort....at last i made it..hehehe
..no need for coding in the VB for barcode..hehe
just put the search code in the text box..then it will do the job..
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top