Limit to list option

jcaptchaos2

Registered User.
Local time
Yesterday, 20:34
Joined
Apr 28, 2011
Messages
12
Hello,

I have this code that when the cursor is in the combo box and scans the bar code it leaves the left 5 numbers in the combo box and then drops the next 3 down to the next text box. It works fine with the limit to list set to no in the (shop order number) combo box. I really need it to limit to that list as sometimes they employee may not scan the bar code but type it in by hand. The code fails because the Shop order number is 8 digits long when it is first scanned but the code brings the 3 digits down the the next text box. Is there a way around this?

Code:
Private Sub Shop_Order_Number_AfterUpdate()
   Static abort As Boolean
    If abort Then abort = False: Exit Sub
    Op_Number = Mid(Shop_Order_Number, 6, 3)
    abort = True
    Shop_Order_Number = Left(Shop_Order_Number, 5)
    Item_Number = DLookup("[itemnumber]", "[shoporderstatus]", "[shoporderstatus]![shopordernumber]= " & [Forms]![Shop Floor Data Entry]![Shop Order Number])
End Sub
 
You could set your Combo's Limit to list property to True.

Rather than scan the bar code directly into the Combo, append it to the underlying table, that populates the Combo, then simply requery the Combo as part of the scan procedure.
 
Thanks for replying, I can set it to "Yes" or "No" unless I am looking at it wrong "True" is not an option. As far as your advice I am only a rookie when it comes to Access so I am not sure how to do that. Any adevice?
 
Yes/No is equivalent to True/False. Yes/No is what you will find in the properties tab of a field/control in design view True/False is used when you are dealing with the same property using code.

Rather than pushing your scanned Bar Code directly into the Combo, you would use an Append Query/SQL to directly append the Bar Code to the underlying table. I've not had any experience with Bar Code Scanners so beyond giving you some general advise I can't really help.

Have a look at the Code here, and perhaps even the sample here for some example of the sort of thing you would need to do.
 
John,

I don't think that is what I need but it is pretty cool and I have another application that I could use your sample on. Bar code scanning in this case is really no different then typing it in by hand. If I typed in 55555123 and hit enter it (the code) would leave the 55555 in the shop order combo box and move the 123 to the op number text box. I am trying to see if there is a way that the shop order combo box "Limit to list" would work or check the shop order combo box after the 123 has been moved and the 55555 is the only thing left. Is there some code that I code add to the end of this that would check the shop order combo box at the end?

Code:
Private Sub Shop_Order_Number_AfterUpdate()
   Static abort As Boolean
    If abort Then abort = False: Exit Sub
    Op_Number = Mid(Shop_Order_Number, 6, 3)
    abort = True
    Shop_Order_Number = Left(Shop_Order_Number, 5)
    Item_Number = DLookup("[itemnumber]", "[shoporderstatus]", "[shoporderstatus]![shopordernumber]= " & [Forms]![Shop Floor Data Entry]![Shop Order Number])
 
(additional code here that says check shop_order_number combo box to make sure the 5 digit number is on the list)
End Sub
 

Users who are viewing this thread

Back
Top Bottom