cancel
Showing results for 
Search instead for 
Did you mean: 

update records through forms

Former Member
0 Kudos

I can display record into the text boxes of form and can also save it through text box but I want to update the displayed records .... how to do that??

Accepted Solutions (1)

Accepted Solutions (1)

former_member184566
Active Contributor
0 Kudos

Hi Sudeshna Basu

I'm assuming you are not using UDO as it would do it for you. You would have to get the value in the text box, see if there is a difference then update it.

To update your own table would do something like the following

oUpDateTable = oCompany.UserTables.Item("YourTable")

Rs = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

For i As Integer = 1 To A.Length - 1

Rs.DoQuery(" Query to check value diff")

If oUpDateTable.GetByKey(Rs.Fields.Item("Code").Value) Then

oUpDateTable.UserFields.Fields.Item ("YourField").Value = "Value"

if oUpDateTable.Update()<>0 Then msgbox("error")

End If

Next i

Hope this helps

Former Member
0 Kudos

Hi Louis,

Thanks for the reply. But could you give me a more detailed info about this code. I am new to SBO so i am not quite familiar with these codes OR is there any other procedure for updation?

Regards,

Sudeshna Basu.

former_member184566
Active Contributor
0 Kudos

Hi Sudeshna Basu

Not a problem. You must declare the object that accesses your user defined table.

Dim oUpDateTable As SAPbobsCOM.UserTable = Nothing

Then assign your user defined table, dont place the @ sign for your table name

oUpDateTable = oCompany.UserTables.Item("YourTable")

Forget about the loop, lets assume you doing just one value. Forget about RS, that was something i used in my code for something else.You need to get the record by it's key so you can update that row. The key is the code column of your table.

If oUpDateTable.GetByKey(CodeColumnValue) Then

'so if it found that code it would go inside here

'get the column and assign a value

oUpDateTable.UserFields.Fields.Item ("YourField").Value = "Value"

'then update the table, if value is 0

'it is succesfull

if oUpDateTable.Update()<>0 Then msgbox("error")

end if

Hope this helps

Answers (0)