Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


cannot work Coding out

cannot work Coding out

cannot work Coding out


Within a long event procedure we have the following code. I am nopt familiar with coding that much and cannot work out what it is doing. we have an issues that in Packs table we have a pack code that gets updated but it is adding in an extra digit on th pack ref. I am just wondering if this part of the code as something to do with it. Any chance someone could explain roughly what it is doing in this part of the code. Thanks

' use pack number to find pack details & populate 'packs' table
Set rsPacks = CurrentDb().OpenRecordset("Packs", dbOpenDynaset)

If Len(Trim(arrLine(3))) > 7 Then
Last2 = UCase(Right(arrLine(3), 2))
If Left(Last2, 1) = "_" Then
Last2 = "/" & Right(Last2, 1)
End If
BarCode = GetBarCode(arrLine(3))

' check for no '/'
If Left(Last2, 1) <> "/" Then
Last2 = Right(Last2, 1)
End If
BarCode = GetBarCode(arrLine(3))
Last2 = ""
End If

RE: cannot work Coding out

To explain this piece of code would require a lot of writing, but you can help yourself by setting some breakpoints in code and see for yourself what's going on. And while stepping thru the code you can hover over the variable to see its value.

---- Andy

There is a great need for a sarcasm font.

RE: cannot work Coding out

I agree with Andy that it's difficult to suggest what's going on since there is an array and a call to another function. In addition to Andy's comment with screen shot you might want to look at FAQ705-7148: How to debug your code.

Hook'D on Access
MS Access MVP 2001-2016

RE: cannot work Coding out

>wondering if this part of the code as something to do with it

There's no mention of a pack ref in there. So who knows? Here's an outline of what the code does:

Returns a barcode related to the string stored in arrLine(3), plus an additional string called Last2 that actually contains 0, 1 or 2 characters dependant on what the original last two characters of arrLine(3) actually were. So assuming:

last two characters = "xy" => Last2 = "Y"
last two characters = "_y" => Last2 = "/Y"
last two characters = "/y" => Last2 = "/Y"

or, if the string in arrLine(3) is 7 or fewer characters => Last2 = ""

RE: cannot work Coding out


I found a bit of the code where the 7 digit was place and changed it to 8.

All is working again.

Thanks for the reply's

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close