Approach User Support homepage Approach User Support
Answers to Frequently Asked Questions about Lotus Approach
Examples LotusScripts
Example databases
Links to other Lotus Approach support services

[Return to contents]

Using SQL from LotusScript

Last updated: 24 Sep 2010

On page 8-51 of 'Developing SmartSuite Applications Using LotusScript' there is an example of embedding SQL SELECT statements in a Script.

Other example LotusScripts using SQL can be found in the Approach User Support Example Databases for Lotus Approach web page:

    http://www.johnbrown.com.au/approach/examples.htm

Using SQL SELECT statements in scripts means that you can use values obtained from the user in the select statement without having to create new queries each time.

Sub GetItem(FindItem as String)

 'the ITEM_NO the user is looking for gets passed to the sub

 ' the line we're focusing on in the SELECT statement would
 ' look something like this:

  Type=dbase

  SELECT invoice97.ACCT_NO,invoice97.INVOICE_DATE,invoice97.QTY_SHIPPED,
   invoice97.ITEM_NO,invoice97.SELL_PRICE,invoice97.PERIOD,invoice97.WEEK
  FROM "C:\lotus\work\approach\invoice97.dbf" invoice97
  WHERE (invoice97.ITEM_NO = FindItem)
  ORDER BY invoice97.PERIOD,invoice97.WEEK
End Sub

[Return to contents]

© Copyright, JohnBrown, Trademarks, Disclaimer, Acknowledgements.