Creating a Custom Form with ADO: Example

This procedure explains how to create a custom form for your Lawson ERP applications by using Microsoft's ActiveX Data Object Data Control feature.

The instructions will guide you through setting up the ADO Data Control and data bound grid control so that you can read and write to a Lawson form. For general information about ADO, see your ActiveX Data Objects documentation from Microsoft.

  1. Start a new VB Project by using Standard EXE in Visual Basic.
  2. Add references to ADO Data Control and the OLE DB DataGrid Control.
  3. Drop a Data Control onto the Form.
  4. Set the Data Control ConnectionString property to:

    "Provider=Lawson.LawOLEDBC;Data Source=XXX;User ID=XXX;Password=XXX"

  5. Set the Data Control's CommandType property to adCmdText
  6. Set the CursorLocation property to adUseServer
  7. Set the CursorType property to adOpenStatic
  8. Set the LockType property to adLockOptimistic
  9. Set the Mode property to adModeReadWrite
  10. Set the RecordSource property to:

    "ags:_TKN=HR06.1&FC=N&JBC-COMPANY=XXX&JBC-JOB-CODE=XXX"

  11. Drop the Data Bound Grid Control onto the form and bind it to the ADO Data Control by using the control's Data Source property.
  12. Adjust the Grid Control Properties—Turn on Add and Delete.
  13. Test your new form by ensuring that you can perform the following functions:
    • Add a new row

    • Delete the new row

    • Change an existing row

    • Undo a change an existing row