Creating a custom form with ADO: example

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

The instructions guides 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. Using Standard EXE in Visual Basic, start a new VB Project.
  2. Add references to ADO Data Control and the OLE DB DataGrid Control.
  3. Drop a Data Control onto the form.
  4. Specify the Data Control ConnectionString property to:
    "Provider=Lawson.LawOLEDBC;Data Source=XXX;User ID=XXX;Password=XXX"
  5. Specify the Data Control's CommandType property to adCmdText.
  6. Specify the CursorLocation property to adUseServer.
  7. Specify the CursorType property to adOpenStatic.
  8. Specify the LockType property to adLockOptimistic.
  9. Specify the Mode property to adModeReadWrite.
  10. Specify 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 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 these functions:
    • Add a new row.

    • Delete the new row.

    • Change an existing row.

    • Undo a change an existing row.