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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why is 'Pricing Unit Price' read-only? 2

Status
Not open for further replies.

JoeAtWork

Programmer
Jul 31, 2005
2,285
CA
Greetings good people of the AccPac forum.

I have written a macro that imports invoices into AccPac. It works perfectly on the development machine. When my client tries to run it, he gets the following error:

Order Detail Attempt to change read-only field 'Pricing Unit Price'

The error occurs when I try to set the PRIUNTPRC field in OE0500. Here is a snippet of my code:

Code:
    'Loop through invoice details
750    For Each objDetail In objInvoice.Details
760        vwDetails.RecordGenerate False
        
770        vwDetailsFields("ITEM").Value = objDetail.Item                  ' Item
        
780        vwDetailsFields("QTYORDERED").Value = objDetail.QtyOrdered      ' Quantity Ordered
[COLOR=red]790        vwDetailsFields("PRIUNTPRC").Value = objDetail.UnitPrice[/color]
        
        'Only override the item description if one was provided in the XML
800        If Len(objDetail.Description) > 0 Then
810            vwDetailsFields("DESC").Value = objDetail.Description
820        End If
        
830        vwDetails.Insert
840    Next

The error occurs on line 790.

What might be different in his AccPac environment that makes this field read-only?

My version:
ACCPAC Advantage Series Enterprise Edition (Version 5.3A Service Pack 3)


 
1. Does this happen when you login as the Accpac ADMIN user?

2. Check that the Price List is populated on the detail line, this should default to the customer's default price list, however if the default price list is not set on the customer then this will be blank and you will get an error when you try to set the price.

3. Check the user's security, maybe the user cannot override the price.
 
Thanks for the answer Etienne.

In the meantime, I discovered I could reproduce the error by creating a security group that doesn't have the “Unit Price Override” permission, and logging in as a user that is in that group.

I have advised my client to review the security settings of the login he is using when running the macro.

This is probably obvious to the seasoned AccPac people in this forum, but this is the first time I've dealt with security groups. I usually write all my macros when logged in as Admin.

Thanks again.

 
You may want to check security before the macro runs, to give the user a little better error message. Each security option has a name. To figure them out, export the security groups to Excel, and look at the RESOURCEID column. This snippet prevents the macro from running if the user's group doesn't have A/P Invoice Edit rights:

Set a4wLinkRead = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READONLY)

If Not a4wLinkRead.SecCheck("APINVOICEE") Then
MsgBox "Sorry, you do not have security rights to export Deltek transactions", , APPHEADER
Exit Sub
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top