on 03-18-2006 1:47 AM
Hi,
I'm trying to add a user field (valid values) in my user table, but i don't know what's wrong with my code.
It creates the field, but not the field that i want.
oUserFieldsMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)
oUserFieldsMD.TableName = sTableName
oUserFieldsMD.Name = sFieldName
oUserFieldsMD.Description = sDescription
oUserFieldsMD.Type = FieldType
oUserFieldsMD.Size = iSize
'Valid Values 1
oUserFieldsMD.ValidValues.Value = "D"
oUserFieldsMD.ValidValues.Description = "Disable"
oUserFieldsMD.ValidValues.Add()
oUserFieldsMD.DefaultValue = "D"
'Valid Values 2
oUserFieldsMD.ValidValues.Value = "A"
oUserFieldsMD.ValidValues.Description = "Active"
oUserFieldsMD.ValidValues.Add()
Dim i As Integer
Dim err As String
i = oUserFieldsMD.Add()
If i <> 0 Then
oCompany.GetLastError(i, err)
SBO_Application.MessageBox(i & "; " & err)
End If
Bruce
Hi Bruce
It looks good, just take out the second one "UserFieldsMD.ValidValues.Add()". Leave the first one. Just take out the second one after oUserFieldsMD.ValidValues.Description = "Active"
Hope this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
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.