Customize Company/Orders forms and generate sequential OrderID

J

jelena

Hello!
I need to generate sequential number of OrderID when I
create a new order for company (Companies/Orders
Folder).Let's say if the last OrderID = 3 under Orders
Folder, I need to generate next OrderID=4 and populate
Orders.txtOrderID when I open a new Order item from
Companies form.

I have some code behind Order form.

How to define Orders folder under Companies and place
Orders.txtOrderID=next_OrderID?

Code below works if I have Orders folder as active.

sub cmd1_click()
Set oClient = CreateObject("MXContact.ClientObject")
Set oFolder = oClient.GetFolderByAlias("Companies")
Set oItems = oFolder.Items
Set oObject = oClient.GetFolderItems(oFolder)
Set oColFolders = oClient.GetFolders()
nFolderCount = oObject.Count
s = oObject.Item(nFolderCount)
s1 = s + 1
msgbox "s1 " & s1
End Sub


Thanks
Jelena
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top