COPYSTR ERROR

Our company has been on NAV since Sept. So far not real impressed. However. this is the current problem I am having.

I work the AR and have not had a problem regarding printing invoices so far. Now, I am getting this error and am tired of waiting for tech support since I have a job to do. Please help.

"The value of COPYSTR parameter 3 is outside of the permitted range.

The current value is: -1

The permitted range is: from 0 to 2147483647"

I have never had this error before and never had a problem as mentioned printing my invoices

Hi bakerperkins,
firstly sorry to hear that you are not impressed by Navision.

The error you are getting does not look like a standard error. It looks more like an error related to a customization. The technical reason for he error is simple and clear, but that is not going to help you get AR moving, sorry [;)] basically it looks like some code is trying to put a negative integer into an option string if that helps. [:$]

To resolve this issue, we really need some information about the issue. What version of Navision are you running. (Go to Help → About Microsoft Business Solutions Navision. There will be a version something like “Version US 4.00SP3 (4.00 SP1)” post the EXACT version here.

Next, and most important, have you requested your Navision partner (NSC) to do some mods to the AR or invoicing modules? Maybe some conditional output printed on the invoice? We would need to know what changes have been made.

Get those questions answered, and we can gt to the next step of getting you some help.

We are on NAV 4.00 sp1.

As for the AR changes. Not resently, I don’t think. I am sure they did before we went live.

Need the full version. I am gussing this si the EXE version. Which objects are you running. Also which report number is this?

This is a result of a modification either to the standard invoice report (10074) or a customized version of it. The version of navision you are running is really not important. You need to turn on the debugger (Tools > Debugger > Active) and run the report again for the invoice you are trying to print.

When te debugger pops you need to see what report number is running and what line the error is occuring in. If you have the report designer you can then go into the object designer and modify the code to resolve the error. If you are not sure how to resolve it then copy the line in here and the report and I am sure someone can further guide you.

You should complain loud to your Microsoft Partner that they cannot resolve this issue in an acceptable time frame.

Well he states that there are no recent mods that could have caused this, so either he is wrong or its some kind of country localization. For instance like in the Indian version where they have a lot of mods related to work flow and authorizations etc. Maybe if its a newer localization, then there is an issue related to some set up change that they have made to this functionality that does not exist in other versions.

Anyway, you state that it is Report 10074, which as you know is a specific localization for North America, so I assume that it’s the US version. In this case I agree with you there is nothing in the US version that would cause this error, so it MUST be a modification. How did you read in this post that it’s a US version by the way?

Problem is caused by the parameters used in COPYSTR, so the error can be avoided by first checking the parameters (probably the outcome of a STRPOS statement)

Portion of the Help from S/Side:

NewString := COPYSTR(String, Position [, Length])

Position

Data type: integer

The position of the first character to copy. The value of Position must be greater than zero (0). If Position is greater than the length of the string, the system returns an empty string.

Length

Data type: integer

The number of characters to copy. Length must be greater than zero (0). If the value of Length means that

This is a developer answer, but its an end user question.

I really wasn’t assuming anything, i just put in the report number as an example of what to look for. He stated that they had not done any modifications recentlly but was sure they did before they went live. That is why either he should run the debugger to find out what report it is (standard or customized) and find out where in the report the error is occurring or go to the reoport (assuming he knows which one) through the designer and try to dig through it for the line of code. Then we could see why the copystr is returning a negative length.

I think everyone has missed the point. This is a guy in AR that needs to collect money, and to do so he needs to print a report. I think its very unlikely that he has access to the Debugger, or if he did how to use it. What he needs form us is some pointers that he cna push back to his Partner to say “Hey fix this”.

Step one is to work out if this could be a bug in standard Navision. First we need to knw the country version, because this may be a localization error. If the systme has been running for 5 months with no problems and then suddenly dies, its a bit odd. If you are correct, and he is runnign th eUS vesion, then 100% I agree with you, there is nothing in the US version that would cause that. But what if its some other country version?

I have seen this error in another context that can perhaps help this user.

If you run the Printer Selections form, you will see if his User ID has been hardcoded to print report ID #### to a specific printer resource. If the printer name is wrong, this error will come up.

He may not have access to this form, but his IT staff should, or his Navision consultant… (i’m IT staff for my company and I have access/knowhow to handle this, so his might as well).

This was a challenge for us in the Citrix environment because i was telling Navision to always print a certain report to a SATO label printer and the local IT support (Danish office) had changed the name of the SATO so that this error occured everytime they tried to print the label. I logged in through Citrix (to see the printers connected to the server from Denmark), selected the proper printer name and → fixed.

Hope this helps!

Thank you! I had this exact same problem and my Partner was telling me it was a printer problem on the user’s PC. I found a printer selection for a Citrix printer added to the users user name. I have no idea how it got there as this user in on the LAN and doesn’t use Citrix. I deleted the printer selection and the user is able to print again.

I have just had the same error and found the following:

//IF COPYSTR(LockingString[1],1,i[1]) = Text2000 THEN BEGIN

IF COPYSTR(LockingString[1],1,15) = Text2000 THEN BEGIN

The first line using an integer variable array gives the error but the second line is OK.

Anyone know whey this is?

It may be that COPYSTR does not like the integer var used in this way?

The odd thing is that the code then checks lines 2 and 3 which do use the integer without a problem.

I joined this forum for the sole purpose of helping who ever googles this next.

In Navision shared printers when installed in windows have to have the exact same name as the name on the share. This is a case sensitive thing. Like the case I just dealt with the shipping printer was installed as “Shipping printer” instead of Shipping Printer".

Hope this helps who ever has this issue next. The version of Nav this happened on was 4.0 SP3.

Thanks and have a nice day.