Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error in SBA SDK While Saving Cash Purchase Entry

4 views
Skip to first unread message

Yemul@discussions.microsoft.com Sham Yemul

unread,
Apr 29, 2010, 4:09:01 AM4/29/10
to
Hello,

I have wrote a function in VB.Net to perform a Cash Purchase in Microsoft
Office Accounting using the Small

Business Accounting SDK.

VB.Net Code:

Dim PurchaseOrder As IPurchaseOrder = DirectCast(sbi.CreatePurchaseOrder,
IPurchaseOrder)
Dim dt As Date = Now.Date

PurchaseOrder.CreatePurchaseOrderLine(DocumentLineType.ContractExpenseLineType)
Dim CustPayment As ICustomerVendorPayment = sbi.CreateVendorPayment
Dim VendorPayment As IVendorPayment = sbi.CreateVendorPayment
VendorPayment.FinancialAccount =
sbi.FinancialAccounts.GetByDisplayNumber("1010")
VendorPayment.FriendlyDocumentName = "Cash Purchase"
PurchaseOrder.DeliveryDate = dt
PurchaseOrder.DocumentDisplayNumber = "8"
PurchaseOrder.FinancialDateTime = dt
PurchaseOrder.PaymentMethod = sbi.PaymentMethods.GetByName("Cash or
Direct Debit")
PurchaseOrder.VendorName.Contains("Supplier123")
VendorPayment.PayToAccountName.Contains("Savings Account")
MsgBox("Test 1 ")
PurchaseOrder.VendorAccount = sbi.VendorAccounts.GetByPrimaryKey(1010)
Dim VendorAc As IVendorAccount = sbi.CreateVendorAccount
VendorAc.Contacts.GetContact(1)
VendorAc.DisplayNumber = 5
PurchaseOrder.VendorAccount = sbi.VendorAccounts.GetByPrimaryKey(1)
Dim ItemLine As IItemLine =
DirectCast(PurchaseOrder.CreatePurchaseOrderLine _
(DocumentLineType.ContractItemLineType), IItemLine)
ItemLine.ChangeLineType(DocumentLineType.ContractItemLineType)
ItemLine.ItemName().Contains("Expense")
ItemLine.FinancialAccount =
sbi.FinancialAccounts.GetByDisplayNumber("6010")
ItemLine.Quantity = 1
ItemLine.UnitPrice = 5000
ItemLine.SubTotal = 5000
VendorPayment.Amount = 5000
PurchaseOrder.Save()

But when i try to save the Cash Purchase entry it shows an error message as:
"The VendorAccountID property

cannot be null". So i need to know how to set the value to VendorAccountID
property?

Thanks in advance
ShamYemul.co.cc
Intellisoft.Co.In

Sham Yemul

unread,
Apr 29, 2010, 4:11:01 AM4/29/10
to
Hello,

When i try to save a Cash Purchase entry in SBA SDK i get this error: "Could
not modify the current record

because it has dependencies. (For example, an item that appears on one or
more documents cannot be deleted.)".

So i want to know what are these dependencies for making Cash Purchase entry?

Regards
ShamYemul.co.cc
Intellisoft.Co.In

icreateofx

unread,
Apr 29, 2010, 6:33:12 PM4/29/10
to
Sham - is there a particular reason why you are creating a new purchase
order for a cash purchase?
I can not locate my OASDK but I am sure there is an example of posting a
cash sale without having to create a new PO.

"Sham Yemul" <Sham Ye...@discussions.microsoft.com> wrote in message
news:E025AA08-21EA-4AEA...@microsoft.com...

Sham Yemul

unread,
Apr 30, 2010, 9:41:01 AM4/30/10
to
Hello ,

thanks for response.

I need help for Purchase Entry, and not Sale,

right now I am stuck-up for "Pay From" on the MOA screen of Purchase Entry,
we can set a financial account like Bank Account, Pitty Cash etc. But I did
not find any method/property or interface that allows setting "Pay From".

Please help me if anyone knows about this.
Regards
Sham

"icreateofx" wrote:

> .
>

0 new messages