on 09-26-2005 12:27 AM
I am getting the contactpersoncode from the saleorder using
ContactPersonCode = salesorder.ContactPersonCode
this is a text number '31'
but as there is onle one contact person on the bus Partner record I get an exeption when using
oBpEmp = oBP.ContactEmployees
oBpEmp.SetCurrentLine(CInt(ContactPersonCode) - 1)
Am I using this code correctly? any pointers?
Hi there,
Why don't you try using recordset?
ors.doquery("Select Name from OCPR Where CntctCode='" & ContactPersonCode & "'")
Then you can put your Contact Person Name Variable = ors.Fields.Item(0).Value
Quite Simple... Save you some process time from looping function.
You can use for other purpose also...
Message was edited by: Erik Tang
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Adele, You have cleared up my confusion on how the contacts were organised.
And Thanks Also to Erik you have provided the solution
Regards George..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi George,
The SetCurrentLine method and the ContactEmployee number does not work together. For each business partner the SetCurrentline runs from 0 (zero) to the number of contacts -1 (minus 1). Say this is what your business partner looks like:
<u>C1000</u>
1-George
4-Jack
5-Jill
31-The One you want
If your code looks like this (to get the one you want):
oBp.GetByKey("C1000")
oBpEmp = oBp.ConactEmployees
oBpEmp.SetCurrentLine(31-1)
You'll get an error as it should actually be
oBpEmp.SetCurrentLine(3)
The only way I can think of solving your problem right now is if you loop through all the contact employees of that specific business partner like:
Dim i As Integer
For i = 0 To oBp.ContactEmployees.Count - 1
oBpEmp.SetCurrentLine(i)
If oBpEmp.InternalCode = ContactPersonCode Then
MessageBox.Show(oBpEmp.Name)
'do your thing...
End If
Next
Hope this helps,
Adele
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.