Barcodes and VBA

ckeezer

Registered User.
Local time
Yesterday, 20:05
Joined
Sep 9, 2005
Messages
13
Here is the scene:
DB1.mdb contains two very simple forms and a table
frm1, frm2 and tbl1

tbl1 contains these fields:
ID#, Name, Type

frm1 is a Tabular form that has three objects:
ID#, Name, Type

frm2 is a Justified form with two objects:
Text0 and btn1

What I need to do is use my barcode scanner to keep my inventory, everything I have has a barcode on it, that is unique to that specific item.

The problem is that some items I get are in a series, like I could get series 1 today with a barcode of 011113 (I know this is not a true barcode), but tomorrow I could get series 2 of the same product and it will have a barcode of 011114.
Let me break down the barcode for you:
01 is the begining of the barcode, this is generic and can change
111 would be the product number this will not change for this item
3 is the end of the barcode and can also change

I have many products and the product number is in different location in the barcode. Sometimes it will be in the middle as in the example above, but it may be in the begining or the end.

I need to be able to scan the item and then click on my btn1 and have it find LIKE products to that barcode.... Can any of you help me with this.

I have tried some like statements but have not been successful.

If you need more infor or clearification, just let me know.
 
ckeezer said:
Here is the scene:
DB1.mdb contains two very simple forms and a table
frm1, frm2 and tbl1... have it find LIKE products to that barcode.... Can any of you help me with this.

How would you want your results to show, as report? query? form?....

So your scan first goes to your Text0 box, then you click btn1 to show a list of "Like" product. Is that what you want?
 
ckeezer, I'm sorry, but your objective is a little vague.
So, for example, barcode 011113, has product number 111, in it.
You may have product 562, and you want to find it, in other barcodes?
Have you considered the InStr()?

This could be very confusing. Because 111 could be found in 2 different places in barcode 011113. And 011125, will give you 111, but it's not necessarily the product Nº.

Are there some static rules here. Is ProdNº, always 3 digits, and is it always 3 characters, from start of code?
If so, let's try this...

Dim strBarcode As String
strBarcode = Mid(txtBarCode,3,3) 'will find 3 digits, starting at 3rd character.
If strBarcode = "111" Then
 
Sorry for taking so long

Ok, I am going to change the way my inventory is housed. I used to house it by Product number vice barcode number, but it seems that it would be much easier to find the complete barcode number that I am looking for rather than part of any one of them.

I need them to be pulled up in frm2 so that the data can be manipulated(i.e; change how many of the product I have on hand or when a new order comes in).

The problem I am having now is that I am getting syntax errors when I try the code, here is what I have:
Private Sub btn1_Click()

If [Text0] = [Catalog Number] Then

DoCmd.FindRecord Me![Text0], , True, , True

If MsgBox(" Is this right?", 4) = 6 Then
Me![Text0].SetFocus
Me![Catalog Number].SetFocus

ElseIf MsgBox("Inventory Item NOT Found. Want to add a new record?", 4) = 6 Then

DoCmd.GoToRecord , , acNewRec
Me![Text0].SetFocus
'Me![id number] = Me![combo pinlook]
Me![Text0].SetFocus

End If
End If
End If

End Sub
 
Let us know which line was highlighted.
I'm assuming this, try this...

If vbOK = MsgBox(" Is this right?", 4) Then
 

Users who are viewing this thread

Back
Top Bottom