Will Szymkowski
asked on
Simple VB Command
Hello Experts,
Need some help writing a small script. We have a label program all barcodes numbers end in either 4 or 7. If the number ends with a 4 then I want to display "LP" on the label. If the number ends in 7 i want it to dispaly "RD". If anyone could write up a small VB script that will work for my needs it would be most appreciated.
Thanks in advance
Need some help writing a small script. We have a label program all barcodes numbers end in either 4 or 7. If the number ends with a 4 then I want to display "LP" on the label. If the number ends in 7 i want it to dispaly "RD". If anyone could write up a small VB script that will work for my needs it would be most appreciated.
Thanks in advance
ASKER
Hey, thanks for the fast response. I'm getting the following error when I use the following command:
The Following script error was found:
OnAutoSelectdEvent(Line 3): Database.caption = 'LP':syntax error
The Following script error was found:
OnAutoSelectdEvent(Line 3): Database.caption = 'LP':syntax error
Oops, use double-quotes instead of single quotes (I was thinking SQL Server for some reason).
Select Case Right(YourBarCode, 1)
Case 4
YourLabelName.Caption = "LP"
Case 7
YourLabelName.Caption = "RD"
End Select
Select Case Right(YourBarCode, 1)
Case 4
YourLabelName.Caption = "LP"
Case 7
YourLabelName.Caption = "RD"
End Select
Hi Spec01,
Use double quotes instead of single quotes.
Regards,
Patrick
Use double quotes instead of single quotes.
Regards,
Patrick
Jim,
Sorry :)
Regards,
Patrick
Sorry :)
Regards,
Patrick
ASKER
Ok, here is what I have put down. Sorry I'm not a programmer ;- P.
Select Case Right(48544, 1)
Case 4
Database.Caption = "LP"
Case 7
Database.Caption = "RD"
End Select
This is the error I'm getting now...
OnAutoSelectedEvent(Line 3): : Object required: ''
Select Case Right(48544, 1)
Case 4
Database.Caption = "LP"
Case 7
Database.Caption = "RD"
End Select
This is the error I'm getting now...
OnAutoSelectedEvent(Line 3): : Object required: ''
If 'Database' is the name of your label, it would probably be a good idea to rename it (lbl_database comes to mind), in case VB is confusing it with a database object.
ASKER
Still having no luck....
The command seems to be error free, but when I print something LP or RD isn't showing up. The program I'm using BarTender Label software.
Anymore help would be appreciated.
Thanks
The command seems to be error free, but when I print something LP or RD isn't showing up. The program I'm using BarTender Label software.
Anymore help would be appreciated.
Thanks
perhaps a checksum * either side?
Case 4
Database.Caption = "*LP*"
Case 7
Database.Caption = "*RD*"
Case 4
Database.Caption = "*LP*"
Case 7
Database.Caption = "*RD*"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Use the first one...
lojk had the correct answer
ASKER
With regards to this queestion, I have still been working on a solution. I was just waiting to see if there would be more answers provided.
Only *so many* ways to skin a cat i guess... Thanks for the point/grade etc..
Select Case Right(YourBarCode, 1)
Case 4
YourLabelName.Caption = 'LP'
Case 7
YourLabelName.Caption = 'RD'
End Select