If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Triming a letter from barcode..
On the boxes I have come in an extra "S" is inlcuded on in the barcode when
compared to the barcode on the item itself. I scan stuff in by the box and scan stuff out by the item I am trying to set an onclose event on a form utilizing vba to trim of the "s" if there is an "s" the field is called barcode I know to use an IFF statement but can not get it right.. What would the code look like? Thanks! |
#2
|
|||
|
|||
Triming a letter from barcode..
GregB wrote:
On the boxes I have come in an extra "S" is inlcuded on in the barcode when compared to the barcode on the item itself. I scan stuff in by the box and scan stuff out by the item I am trying to set an onclose event on a form utilizing vba to trim of the "s" if there is an "s" the field is called barcode I know to use an IFF statement but can not get it right.. What would the code look like? Thanks! Form Close is the wrong event. Either use AfterUpdate of the control or BeforeUpdate of the form. If Right(Me.BarCode,1) = "S" Then Me.BarCode = Left(Me.BarCode, Len(Me,Barcode)-1) End If Extra characters on the end of a barcode are usually check-digits and for your scanner to "see" them as characters in the output it would have to be set up for the wrong barcode type. Also, check-digits are seldom always the same character so your logic might not work as you expect. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#3
|
|||
|
|||
Triming a letter from barcode..
The Close event of the form is too late.
Use the AfterUpdate event procedure of the text box. Something like this: Private Sub barcode_AfterUpdate() If Me.barcode Like "?*S" Then Me.barcode = left(Me.barcode, len(Me.barcode) - 1) End If End Sub -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "GregB" wrote in message ... On the boxes I have come in an extra "S" is inlcuded on in the barcode when compared to the barcode on the item itself. I scan stuff in by the box and scan stuff out by the item I am trying to set an onclose event on a form utilizing vba to trim of the "s" if there is an "s" the field is called barcode I know to use an IFF statement but can not get it right.. What would the code look like? Thanks! |
#4
|
|||
|
|||
Triming a letter from barcode..
Is it possible there could be a valid s on the end of your bar code so that
rather than abcdefss you want abcdefs as a result? If so, you can still use either of the suggested solutions except you would need to test for the last two characters being "ss" "GregB" wrote in message ... On the boxes I have come in an extra "S" is inlcuded on in the barcode when compared to the barcode on the item itself. I scan stuff in by the box and scan stuff out by the item I am trying to set an onclose event on a form utilizing vba to trim of the "s" if there is an "s" the field is called barcode I know to use an IFF statement but can not get it right.. What would the code look like? Thanks! |
#5
|
|||
|
|||
Triming a letter from barcode..
Thanks Guys, sorry for the late reply I was on vacation. Hopefully you still
will look at this. I trired Allens and Ricks method but it would not work... And the S is on the begining of the barcode. S######### The code you produced me dosn't proivde any errors it just dosn't do anything... Of course I tried putting in serial numbers with an S at the end.... still nothing? Whats going on? THanks "Allen Browne" wrote: The Close event of the form is too late. Use the AfterUpdate event procedure of the text box. Something like this: Private Sub barcode_AfterUpdate() If Me.barcode Like "?*S" Then Me.barcode = left(Me.barcode, len(Me.barcode) - 1) End If End Sub -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "GregB" wrote in message ... On the boxes I have come in an extra "S" is inlcuded on in the barcode when compared to the barcode on the item itself. I scan stuff in by the box and scan stuff out by the item I am trying to set an onclose event on a form utilizing vba to trim of the "s" if there is an "s" the field is called barcode I know to use an IFF statement but can not get it right.. What would the code look like? Thanks! |
#6
|
|||
|
|||
Triming a letter from barcode..
Private Sub barcode_AfterUpdate()
If Me.barcode Like "S?*" Then Me.barcode = mid(Me.barcode, 1) End If End Sub -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "GregB" wrote in message ... Thanks Guys, sorry for the late reply I was on vacation. Hopefully you still will look at this. I trired Allens and Ricks method but it would not work... And the S is on the begining of the barcode. S######### The code you produced me dosn't proivde any errors it just dosn't do anything... Of course I tried putting in serial numbers with an S at the end.... still nothing? Whats going on? THanks "Allen Browne" wrote: The Close event of the form is too late. Use the AfterUpdate event procedure of the text box. Something like this: Private Sub barcode_AfterUpdate() If Me.barcode Like "?*S" Then Me.barcode = left(Me.barcode, len(Me.barcode) - 1) End If End Sub "GregB" wrote in message ... On the boxes I have come in an extra "S" is inlcuded on in the barcode when compared to the barcode on the item itself. I scan stuff in by the box and scan stuff out by the item I am trying to set an onclose event on a form utilizing vba to trim of the "s" if there is an "s" the field is called barcode I know to use an IFF statement but can not get it right.. What would the code look like? |
#7
|
|||
|
|||
Triming a letter from barcode..
nothing happens Allens...???
"Allen Browne" wrote: Private Sub barcode_AfterUpdate() If Me.barcode Like "S?*" Then Me.barcode = mid(Me.barcode, 1) End If End Sub -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "GregB" wrote in message ... Thanks Guys, sorry for the late reply I was on vacation. Hopefully you still will look at this. I trired Allens and Ricks method but it would not work... And the S is on the begining of the barcode. S######### The code you produced me dosn't proivde any errors it just dosn't do anything... Of course I tried putting in serial numbers with an S at the end.... still nothing? Whats going on? THanks "Allen Browne" wrote: The Close event of the form is too late. Use the AfterUpdate event procedure of the text box. Something like this: Private Sub barcode_AfterUpdate() If Me.barcode Like "?*S" Then Me.barcode = left(Me.barcode, len(Me.barcode) - 1) End If End Sub "GregB" wrote in message ... On the boxes I have come in an extra "S" is inlcuded on in the barcode when compared to the barcode on the item itself. I scan stuff in by the box and scan stuff out by the item I am trying to set an onclose event on a form utilizing vba to trim of the "s" if there is an "s" the field is called barcode I know to use an IFF statement but can not get it right.. What would the code look like? |
#8
|
|||
|
|||
Triming a letter from barcode..
I think Allen intended:
If Me.barcode Like "S?*" Then Me.barcode = mid(Me.barcode, 2) End If End Sub 2 instead of 1. 1 returns the entire string. "GregB" wrote in message ... nothing happens Allens...??? "Allen Browne" wrote: Private Sub barcode_AfterUpdate() If Me.barcode Like "S?*" Then Me.barcode = mid(Me.barcode, 1) End If End Sub -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "GregB" wrote in message ... Thanks Guys, sorry for the late reply I was on vacation. Hopefully you still will look at this. I trired Allens and Ricks method but it would not work... And the S is on the begining of the barcode. S######### The code you produced me dosn't proivde any errors it just dosn't do anything... Of course I tried putting in serial numbers with an S at the end.... still nothing? Whats going on? THanks "Allen Browne" wrote: The Close event of the form is too late. Use the AfterUpdate event procedure of the text box. Something like this: Private Sub barcode_AfterUpdate() If Me.barcode Like "?*S" Then Me.barcode = left(Me.barcode, len(Me.barcode) - 1) End If End Sub "GregB" wrote in message ... On the boxes I have come in an extra "S" is inlcuded on in the barcode when compared to the barcode on the item itself. I scan stuff in by the box and scan stuff out by the item I am trying to set an onclose event on a form utilizing vba to trim of the "s" if there is an "s" the field is called barcode I know to use an IFF statement but can not get it right.. What would the code look like? |
#9
|
|||
|
|||
Triming a letter from barcode..
Thanks, Dave. Greg, that's right: you want from the 2nd char.
-- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Klatuu" wrote in message ... I think Allen intended: If Me.barcode Like "S?*" Then Me.barcode = mid(Me.barcode, 2) End If End Sub 2 instead of 1. 1 returns the entire string. "GregB" wrote in message ... nothing happens Allens...??? "Allen Browne" wrote: Private Sub barcode_AfterUpdate() If Me.barcode Like "S?*" Then Me.barcode = mid(Me.barcode, 1) End If End Sub "GregB" wrote in message ... Thanks Guys, sorry for the late reply I was on vacation. Hopefully you still will look at this. I trired Allens and Ricks method but it would not work... And the S is on the begining of the barcode. S######### The code you produced me dosn't proivde any errors it just dosn't do anything... Of course I tried putting in serial numbers with an S at the end.... still nothing? Whats going on? THanks "Allen Browne" wrote: The Close event of the form is too late. Use the AfterUpdate event procedure of the text box. Something like this: Private Sub barcode_AfterUpdate() If Me.barcode Like "?*S" Then Me.barcode = left(Me.barcode, len(Me.barcode) - 1) End If End Sub "GregB" wrote in message ... On the boxes I have come in an extra "S" is inlcuded on in the barcode when compared to the barcode on the item itself. I scan stuff in by the box and scan stuff out by the item I am trying to set an onclose event on a form utilizing vba to trim of the "s" if there is an "s" the field is called barcode I know to use an IFF statement but can not get it right.. What would the code look like? |
Thread Tools | |
Display Modes | |
|
|