vbs type mismatch error in quotation breakout

Discussions relating to breakout scripting, .NET and COM programming with Jiwa objects.

vbs type mismatch error in quotation breakout

Postby aegean66 » Sun Apr 14, 2019 1:05 pm

Hi there,
Hoping someone can help with this vbs problem that has stumped me.
It is used in the Quotation section of JIWA 6.
Code is below and I get a type mismatch error.
Have tried quite a few things but oddly the exact same code in the sales order module works a treat?

'Read csv file and store values in variables

For i = 2 To osheet.usedrange.rows.count
vLineNumber = oSheet.Cells(i,1).Value
vFineLine = oSheet.Cells(i,4).Value
vQty = oSheet.Cells(i,5).Value
vPrice = oSheet.Cells(i,8).Value

'Call function to match value in spreadsheet to corresponding value in internal JIWA SQL database

If GetPartNo(SalesQuoteObject.Database, vFineLine, PartNo, lErrorModule, lErrorMessage) = False

Then
MsgBox lErrorModule & vbCrLf & lErrorMessage & "Line No "&(i-1)
Else

'Begin adding the items on spreadsheet to JIWA Quote
'Line below - in bold - (Line 75) produces error
'Type Mismatch: 'SalesQuoteObject.SalesQuoteLines.AddInventoryItem' at Line 75
'PartNo variable is definitely a string (they all contain text anyway)

ReturnCode = SalesQuoteObject.SalesQuoteLines.AddInventoryItem(PartNo, 1 , NewKey)
SalesQuoteObject.SalesQuoteLines(NewKey).QuantityOrdered = vQty
SalesQuoteObject.SalesQuoteLines(NewKey).SellPriceExGST = vPrice
SalesQuoteObject.SalesQuoteLines(NewKey).LineNumber = vLineNumber
End If

'Note I use EXACT same code in Sales order (except obviously replacing the SalesQuoteObject and SalesQuoteLines object)
'Calling same function. That works perfectly!

Next
Set oSheet = Nothing
oBook.Close
Set oBook = Nothing
oXL.Quit
Set oXL = Nothing

End Sub
aegean66
Occasional Contributor
Occasional Contributor
 
Posts: 36
Joined: Wed Mar 02, 2011 2:26 pm
Topics Solved: 2

Re: vbs type mismatch error in quotation breakout

Postby aegean66 » Mon Apr 15, 2019 10:21 am

Further to this:

THIS WORKS PEREFECTLY

ReturnCode = SalesOrderObject.SalesOrderLines.AddInventoryItem("CHEMBRU006", 1, NewKey)
SalesOrderObject.SalesOrderLines(NewKey).QuantityOrdered = 12


THIS DOESN'T WORK ( It produces error 'Type Mismatch: 'SalesQuoteObject.SalesQuoteLines.AddInventoryItem' at Line 75)

ReturnCode = SalesQuoteObject.SalesQuoteLines.AddInventoryItem("CHEMBRU006", 1, NewKey)
SalesQuoteObject.SalesQuoteLines(NewKey).QuantityOrdered = 12
aegean66
Occasional Contributor
Occasional Contributor
 
Posts: 36
Joined: Wed Mar 02, 2011 2:26 pm
Topics Solved: 2

Re: vbs type mismatch error in quotation breakout

Postby Mike.Sheen » Tue Apr 16, 2019 11:16 am

All I can tell you is the the signature for the SalesOrderLines AddInventoryItem is identical to that of the QuoteLines AddInventoryItem in 06.05.13

So, there should be no difference in behaviour.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: vbs type mismatch error in quotation breakout

Postby aegean66 » Wed Apr 17, 2019 10:03 am

Thanks for responding Mike

I have literally used only these two lines of code - Sales Order works; Quotes don't.

Think I'll wait for an epiphany to strike before tackling again otherwise I'll end up in a dark corner sucking my thumb

Cheers,
Damon.
aegean66
Occasional Contributor
Occasional Contributor
 
Posts: 36
Joined: Wed Mar 02, 2011 2:26 pm
Topics Solved: 2

Re: vbs type mismatch error in quotation breakout

Postby Mike.Sheen » Wed Apr 17, 2019 10:14 am

The version of Jiwa may be relevant - are you using 06.05.13?
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: vbs type mismatch error in quotation breakout

Postby aegean66 » Thu Apr 18, 2019 1:28 pm

Definitely 6.5.13.

Screenshot with code and error below.

https://www.dropbox.com/s/0ha6kwsq8ocvg2m/ScreenShot.gif?dl=0
aegean66
Occasional Contributor
Occasional Contributor
 
Posts: 36
Joined: Wed Mar 02, 2011 2:26 pm
Topics Solved: 2

Re: vbs type mismatch error in quotation breakout

Postby aegean66 » Tue Apr 30, 2019 4:25 pm

Believe it or not !!!

I used the two lines below and got a "type mismatch" error (as previously reported)

ReturnCode = SalesQuoteObject.SalesQuoteLines.AddInventoryItem("CHEMBRU066", 1, NewKey)
SalesQuoteObject.SalesQuoteLines(NewKey).QuantityOrdered = 12

After playing around for a while I decided to use the following code (Note the use of Cstr)

ReturnCode = SalesQuoteObject.SalesQuoteLines.AddInventoryItem("CHEMBRU066", 1, CStr(NewKey))
SalesQuoteObject.SalesQuoteLines(NewKey).QuantityOrdered = 12

It WORKED (populated the quote) but failed on the second line ("object required")

Here is the kicker though; I go back to the original code and it also worked for the first line, but again got an "object required" error for the second line (Why?).

I will solve this! it's in my DNA dammit.
aegean66
Occasional Contributor
Occasional Contributor
 
Posts: 36
Joined: Wed Mar 02, 2011 2:26 pm
Topics Solved: 2


Return to Technical / Programming

Who is online

Users browsing this forum: No registered users and 0 guests

cron