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

ACCPAC 5.2: Auto Transfer VB code Error

Status
Not open for further replies.

hagi7

Programmer
Dec 19, 2004
3
AU
Hi All

I have searching many website to find out ACCPAC forum.
I endup found this is the best information on the webbsite.

Can anyone help me with below Auto Transfer error.

----------------------------------------------
Dim Session As ACCPACXAPILib.xapiSession
Set Session = CreateObject("ACCPAC.xapisession")
Session.Open "ADMIN", "ADMIN", "DBMS", Date, 0

Dim viewTransferHeader As ACCPACXAPILib.xapiView
Set viewTransferHeader = Session.OpenView("IC0740", "IC")

Dim TransferHeaderFields As ACCPACXAPILib.xapiFields
Set TransferHeaderFields = viewTransferHeader.Fields


Dim viewTransferDetail As ACCPACXAPILib.xapiView
Set viewTransferDetail = Session.OpenView("IC0730", "IC")

Dim TransferDetailFields As ACCPACXAPILib.xapiFields
Set TransferDetailFields = viewTransferDetail.Fields

viewTransferHeader.Init
TransferHeaderFields("TRANFENSEQ").Value = "100"
TransferHeaderFields("TRANSNUM").Value = "10"
TransferHeaderFields("HDRDESC").Value = "TEST"
TransferHeaderFields("REFERENCE").Value = "transfer"


'detail insert
viewTransferDetail.Init
TransferDetailFields("TRANFENSEQ").Value = "100"
TransferDetailFields("LINENO").Value = "100"
TransferDetailFields("ITEMNO").PutWithoutVerification "MWL6-4"
TransferDetailFields("FROMLOC").value ="P1" 'error from here
TransferDetailFields("TOLOC").Value = "P2"
TransferDetailFields("QUANTITY").Value = "12"
TransferDetailFields("QTYREQ").Value = "12"

viewTransferDetail.Insert
viewTransferHeader.Insert

MsgBox "Transfer OK"


Set viewTransferHeader = Nothing
Set TransferHeaderFields = Nothing
Set viewTransferDetail = Nothing
Set TransferDetailFields = Nothing
-----------
Thanks

Hagi
 
No, we can't help you. You didn't say what the error was.

Jay Converse
IT Director
Systemlink, Inc.
 
Oh! Sorry for that.
Thank you for your quick reply.

Error message is "View called error"
at TransferDetailFields("FROMLOC").value ="P1" 'error from here

So, I tried this ,
TransferDetailFields("FROMLOC").PutWithoutVerification ("P1"), but still same error come up.

When I import from ACCPAC standard menu with these filed and same value, there was no error and worked good.

I have no idea what I did wrong.

Regards,

Hagi
 
I checked some of my old code, and I wasn't able to do this. Instead, I wrote out the records to a CSV file, then did this:

Dim mImport As New ImportExport
Dim iRet As Boolean
mImport.Open mDBLinkCmpRW
mImport.SetView "IC0740", "", VIEW_SEQUENCED_HEADER, Null
mImport.SetView "IC0730", "IC0740", VIEW_DETAIL_SEQUENCED, Null

mImport.ExecuteImportScript "m:\shared\data\transfer\transfer.xml", iRet

where transfer.xml pointed to the CSV file.


Jay Converse
IT Director
Systemlink, Inc.
 
Hi Jay

Thank you for your reply.
I have got a hit from recorded ACCPAC macro.
I added Compose and modified as below then it worked.
Thanks,
Hagi
-----------
viewTransferDetail.Compose Array(viewTransferHeader)
viewTransferHeader.Compose Array(viewTransferDetail)

viewTransferHeader.Init
TransferHeaderFields("TRANFENSEQ").PutWithoutVerification ("0") ' Sequence Number

viewTransferHeader.Init
viewTransferDetail.Init
TransferHeaderFields("HDRDESC").Value = "TEST Transfer"
TransferHeaderFields("REFERENCE").Value = "Reference"

'detail insert
viewTransferDetail.Init
TransferDetailFields("ITEMNO").PutWithoutVerification "MWL6-4"
TransferDetailFields("LINENO").PutWithoutVerification ("0")
TransferDetailFields("FROMLOC").Value = "P1" 'From Location
TransferDetailFields("TOLOC").Value = "P2" 'To Location
TransferDetailFields("QTYREQ").Value = "1" ' Quantity Requested
TransferDetailFields("QUANTITY").Value = "1" ' Quantity Transferred

viewTransferDetail.Insert
viewTransferHeader.Insert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top