Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cannot work Coding out 1

Status
Not open for further replies.

Cpreston

MIS
Mar 4, 2015
969
0
16
GB
Hi

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
Else
BarCode = GetBarCode(arrLine(3))
Last2 = ""
End If
 
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.

TT_qtgzs6.png



---- Andy

There is a great need for a sarcasm font.
 
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.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
>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 =
 
Hi

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top