The CodeTabelServer service object allows access to the table entries from an existing table.

The TableLookupHandler service object allows use of all the functionality of the RE7 tables. New table entries can be added and the maintenance form can be viewed.

Option Explicit

Private ocodetableserver As CCodeTablesServer

Private otablelookuphandler As CTableLookupHandler

Private Sub ComboBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)

'This example requires a form with a combobox named ComboBox1 _

'in order to work properly

Dim omsgbox As VbMsgBoxResult

If Len(ComboBox1.Text) > 0 Then

   If ocodetableserver.GetTableEntryID(ComboBox1.Text, tbnumTitles) = 0 Then

       omsgbox = MsgBox("Do you want to add '" & ComboBox1.Text & "' to the  " & _

           ocodetableserver.TABLENAME(tbnumTitles) & " table?", vbYesNo)

       Select Case omsgbox

           Case vbYes

               otablelookuphandler.AddEntry True, tbnumTitles, , ComboBox1.Text

           Case vbNo


       End Select

   End If

End If

End Sub

Private Sub UserForm_Initialize()

   Dim reservice As REServices

   Set reservice = New REServices

   reservice.Init REApplication.SessionContext

   Set ocodetableserver = reservice.CreateServiceObject(bbsoCodeTablesServer)

   ocodetableserver.Init REApplication.SessionContext

   ocodetableserver.LoadCombo ComboBox1, tbnumTitles

   Set otablelookuphandler = reservice.CreateServiceObject(bbsoTableLookupServer)

   otablelookuphandler.Init REApplication.SessionContext, ocodetableserver


   Set reservice = Nothing

End Sub

Private Sub UserForm_Terminate()


   Set otablelookuphandler = Nothing



   Set ocodetableserver = Nothing

End Sub

Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures. Our Customer Support can help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality. If you are interested in learning more about the VBA and API modules, contact your account manager.