betterbong / excel-connector

Automatically exported from code.google.com/p/excel-connector
0 stars 0 forks source link

Error 424 in sfUpdate, Object Required #6

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Using the EE connector
2. Try to update a Custom Number field
3.

What is the expected output? What do you see instead?
Expect to update the field. Get an Error message: Error 424 in sfUpdate_New, 
Object Required

What version of the product are you using? On what operating system?
Win Vista. Also Win 7. With Excel 2003, 2007. EE connector.

Please provide any additional information below. Code seems to be attempting 
convert types and fails to convert percentages to decimals eg, '10%' to '0.01'. 
It attempts to access a non-existent property of the variant data type. The 
attached repair seems to work, but not well tested. Need to remove the fixed2 
suffix before installing as per original.

Original issue reported on code.google.com by jwil...@orcon.net.nz on 9 Nov 2010 at 9:47

Attachments:

GoogleCodeExporter commented 8 years ago
can you post a bit of code showing what changed ?

Original comment by vneh...@gmail.com on 24 Nov 2010 at 4:07

GoogleCodeExporter commented 8 years ago
what were the specs on the custom number field ? i'd like to reproduce this.

Original comment by vneh...@gmail.com on 24 Nov 2010 at 4:08

GoogleCodeExporter commented 8 years ago

Original comment by vneh...@gmail.com on 24 Nov 2010 at 4:08

GoogleCodeExporter commented 8 years ago
Hi Ron

I commented up the code I attached to the issue report. If you search on "JW2" 
you will find the changes I have made. Incidentally, I have also marked up 
changes I made for issue "4" as "JW1".

The function I have modified is called: AdjustFieldtype() located in the 
s_force module. 

The original code was: 
If Right(vntValue.NumberFormat, 1) = "%" Then AdjustFieldtype = AdjustFieldtype 
* 100

The new code is:
If Right(vntValue, 1) = "%" Then AdjustFieldtype = AdjustFieldtype / 100

As goes the specs of the number field, I didn't dig very deep, but I believe 
that any number field will trigger this code, even if it has no decimal places. 
It fails no matter what you put in the field in Excel (decimal [type = number] 
or a percentage [type = text]). If you can't replicate it, pls get back to me 
and I will dig further for you.

BTW: 
 - I wouldn't be without the Excel Connector. Despite its foibles, it is an extremely useful tool. 
 - It would great to get the source code on Google for the PE version as I have not been able to make repairs to this code as the code base in the XLA file is password protected. 
 - Apologies for making unmanaged mods to your code. I was not aware that you were actively managing the code anymore.

Thx
James

Original comment by ja...@sqwarepeg.com on 29 Nov 2010 at 7:18

GoogleCodeExporter commented 8 years ago
Due to recent changes made by Google Apps, my account details have changed. 
Please use the Sqwarepeg details as per Comment 4.

Original comment by ja...@sqwarepeg.com on 29 Nov 2010 at 8:27

GoogleCodeExporter commented 8 years ago
i think this works correctly, if you enter 33% excel converts that to 0.33 
which is then passed into the VBA code.  

There is no way to tell if the original user entered 0.33 or 33%

it appears there is no way to correct this ( behavior of excel ), so the % 
symbol is not a decorator, but is in fact a divide by 100 operator.   The 
solution of multiplying all numbers by 100 is not correct for any other number 
that does not have % appended and the % is stripped off so there is no way to 
determine if it was set or not ( as far as i can tell)

the fix is to remove any % symbols before updating.

this code only executes when SKIPHIDDEN is set to true

Original comment by vneh...@gmail.com on 29 Nov 2010 at 7:07

GoogleCodeExporter commented 8 years ago
There are 2 separate issues here:

1) The VBA code produces the error "Error 424 in sfUpdate_New, Object Required" 
on Excel 2003 and 2007 when the identified line of code is executed. I presume 
this results from use of "vntValue.NumberFormat". The NumberFormat property 
does not exist for vntValue. Were you not able to replicate this failure?

2) Assuming the above issue has been resolved, the second issue will only occur 
if the Excel cell being updated is configured with a Text NumberFormat, and the 
relevant SFDC field being updated is of type Number. I have tested this and 
found that updating a text cell containing 33% results in the value 3300 being 
written into the SFDC Number field. If the cell is configured with a Numeric 
NumberFormat, then you are correct, the % symbol is not passed to the VBA code 
and it runs perfectly. The code that detects the % symbol can only have been 
designed to convert text input to numeric - otherwise it would be meaningless. 
Given text input, I can see no other useful purpose for the code other than to 
adjust the value of 33% to 0.33 - ie divide by 100. 

I have not tested using Excel cell NumberFormat = Percentage or SFDC field type 
= Percent. Perhaps this is what the code is designed to cater for??

Original comment by ja...@sqwarepeg.com on 30 Nov 2010 at 6:46