Macro Actions »

Back Help Home

AddRecord

CallForm

CallMacro

CallModule

CancelEvent

ClearScribble

CloseForm

CreateControl

DAddRecord

DDeleteRecord

DeleteControl

DeleteRecord

DeleteRegistry

DrawEllipse

DrawLine

DrawRectangle

DrawText

DUpdateRecord

DuplicateRecord

ExecMacro

ExportToCSV

FindNext

FindRecord

FirstRecord

GotoRecord

ImportFromCSV

KillTimer

LastRecord

MoveControl

MsgBeep

MsgBox

NextRecord

OpenQuery

PlaySound

PrevRecord

PrintForm

Quit

Recalc

RequeryControl

RequeryForm

RunApp

RunSQL

Save

SaveScribble

ScrollScreen

SetClipboard

SetComboSource

SetControl

SetFocus

SetFormSource

SetListSource

SetRegistryInt

SetRegistryStr

SetTimer

SetZOrder

ShowInputPanel

ShowScrollBar

ShowWaitCursor

StopSound

TreeDeleteItem

TreeDeleteItemEx

TreeInsertItem

TreeInsertItemEx

TreeSetItem

TreeSetItemEx
TreeSetItemIDEx

TreeSortItem

TreeSortItemEx

UpdateAll

UpdateRecord

Conditional and Variables

If
ElseIf
Else
EndIf

EndMacro

DoWhile
EndDoWhile

Dim

SetVar

Pocket Outlook Specific

PolContactAdd

PolContactDelete

PolContactFind

PolContactFindNext

PolContactSort

Columns in the Pocket Outlook Database

Supported Macro Actions

AddRecord (main/subform).

Add a new record on a Main/SubForm

 

Argument

Main/Subform: A Main/SubForm to which the new record is appended.

 

Examples

AddRecord (MainForm)
AddRecord (SubForm1)
 

CallForm (callform, [query], [find], datamode, [macro])

Open a Form

 

Arguments

Callform:  The name of the form to open
Query:  A SQL Query to select records from the form's underlying table. To use the form's default RecordSource, leave this argument blank.

Find:   An expression to find a data.
Datamode: Data entry mode. 

Add - Open the form in Edit mode, then add a new record.
Edit - Open the form in Edit mode.
You can edit existing records and add new records.

ReadOnly - Open the form in ReadOnly mode.
You can only view records.

Macro: A macro name.
To open a form, and run a macro, select a macro saved in the form you want to open.

 

Examples

CallForm (EmployeeForm, , , Add, )
CallForm (EmployeeForm, , Emplyees.EmployeeID=!Orders.Employee, Edit, )
CallForm (OrderDetailForm,
{"SELECT* FROM OrderDetals WHERE OrderDetails.OrderID=&OrderIDControl"}
,
 OrderDetails.ProductID=3, Edit, )
CallForm (EmployeeForm, , , Edit, Macro1 )

<Top>
 

CallMacro (Macro)

Run a macro saved in the current form.

 

Argument

Macro:   The name of the macro

 

Example

CallMacro (Macro2)
 

CallModule(module,param1,param2,...,param10) [Version 2.0 and above]

Call the specified module.


Arguments

Module: specify a module.
PrarmN: specify variables to be passed to the specified module. This should be a local or global variable. You can pass max. of 10 parameters.

Example

Dim(var1)
Dim(var2)
SetVar(@var1, 1)
CallModule(myModule1, @var1, @var2 )
MsgBox(@var2)
 

CancelEvent()

Cancel the event that caused SprintDB Pro to run the macro containing this action.

The following events can be canceled by the CancelEvent action:

BeforeUpdate, OnUpdate.

Remarks
In a form, you typically use the CancelEvent action in a validation macro with the BeforeUpdate event property. When a user enters data in a control or record, SprintDB Pro runs the macro before updating the data to the database. If the data fails the validation conditions in the macro, the CancelEvent action cancels the update process before it starts.

<Top >
 

ClearScribble (ScribbleControl) [Version 1.5 and above]

Clears a scribble.

 

Argument

ScribbleControl: the name of the scribble control.

 

Example

ClearScribble (&scribble1)
 

CloseForm ()

Closes the form.
 

CreateControl (Main/SubForm,Type,Style,Name,Caption,Left,Top,Width,Height,BoundTabControl,BoundTabPa ge) [Version 1.7 and above]

Creates a control at run-time.

 

Arguments

Main/SubForm: specifies a Main/Subform that the control belongs to.

Type: specifies the type of the control.
"Button","EditBox","CheckBox","Label","List","DropDownBox","PictureBox","ScribbelBox"

Style: specifies the control style.
The available styles are:
"Visible",
"Border",
"Locked",
"Center", "Right", "Left" : Text alignment.
"AutoHScroll", "HScrollBar", "VScrollBar", "MultiLine" : for editbox only.
"MonthCalendar", "DatePicker", "DateTimePicker", "TimePicker" : for editbox only.

Name: the name of the control.
Caption : specifies the caption of the control - for label and button control only.
Left, Top, Width, Height: specifies the control's position and size.
BoundTabControl : specifies the TabControl name if the control is be located on a tab control.
BoundTabPage : specifies the index of TabPage on the TabControl. The index starts with 1.

 

Examples

CreateControl(MainForm,EditBox,myedit1,,"Visible+Border+AutoHScroll",10,10,100,20)
CreateControl(MainForm,Label,,mylabel1,"Label1:","Visible+Border",10,10,100,20,&tabControl 1,2)

<Top>
 

DAddRecord (fieldvalues, domain)

Appends a record to the end of a table that contains the specified field values.

 

Arguments

Fieldvalues: (field1=value1[,field2=value2,…])
specifies the names of the fields and the field values inserted into the new record.
Domain: the name of the table to which the new record is appended.

 

Examples 

DAddRecord (OrderDetails.ProductID=3, OrderDetails)
DAddRecord ((OrderDetails.ProductID=3, OrderDetails.Quantity=10), OrderDetails)
 

DDeleteRecord (Domain,[criteria])

Deletes record(s) that meet the criteria.

 

Arguments

Domain: The name of the table to remove the records from.
Criteria: An optional expression used to restrict the range of data on which a DDeleteRecord action is performed. Criteria is equivalent to the WHERE clause in an SQL expression, without the word WHERE.

If Criteria is omitted, the DDeleteRecord action deletes all records in the table.

 

Examples

DDeleteRecord (OrderDetails, OrderDetails.OrderID=&OrderID )
DDeleteRecord (OrderDetails, OrderDetails.OrderID=!Order.OrderID )
 

DeleteControl [Version 1.7 and above]

Deletes the specified control.

 

Argument

Specified control

 

Examples

DeleteControl (&TextID)

<Top>
 

DeleteRecord (main/subform,confirmation)

Deletes the current record in a Main/SubForm.

 

Argument

Main/subform: a Main/SubForm to delete the current record from.

Confirmation: Display a confirmation dialog box before deleting record. To disable the confirmation dialog box, set it to No.

 

Examples 

DeleteRecord (MainForm)
DeleteRecord (SubForm1)
 

DeleteRegistry (section, entry) [Version 1.5 and above]

Deletes the specified registry entry.

 

Arguments

Section: a string expression that specifies the section containing the entry.
Entry: a string expression that specifies the entry.
If the entry is omitted, DeleteRegistry deletes the entire section.

 

Examples

DeleteRegistry ("config", "count")
DeleteRegistry ("config")

<Top>
 

DrawEllipse() [Version 2.0 and above]

Draw an ellipse in the specified bounding rectangle.

 

Syntax
DrawEllipse(x1,y1,x2,y2,borderColor,fillColor)


Arguments

X1,y1,x2,y2: specify the x,y coordinates of the bounding rectangle's upper-left and lower-right corner..
BorderColor: specify the RGB color used to draw the ellipse.
Fillcolor: specify the RGB color used to fill the ellipse. You can omit this argument.

Example

[OnPaint event of main form]
DrawEllipse(1,1,100,100,RGB(255,0,0),RGB(0,255,0))
 

DrawLine() [Version 2.0 and above]

Draw a line on the form screen.

 

Syntax
DrawLine(x1,y1,x2,y2,color)


Arguments

X1,y1,x2,y2: specify the starting point and end point for the line.
Color: specify RGB color used to draw a line.

Example

[OnPaint event of main form]
DrawLine(1,1,100,100,RGB(255,0,0))
 

DrawRectangle() [Version 2.0 and above]

Draw a rectangle on a Form screen using the specified colors.

 

Syntax
DrawRectangle(x1,y1,x2,y2,borderColor,fillColor)


Arguments

X1,y1,x2,y2: specify the x,y coordinates of the rectangle's upper-left and lower-right corner.
BorderColor: specify the RGB color used to draw the rectangle.
Fillcolor: specify RGB color used to fill the rectangle. If you omit this argument, DrawRectangle() will not fill the rectangle.


Example

[OnPaint event of main form]
DrawRectangle(1,1,100,100,RGB(255,0,0),RGB(0,255,0))
DrawRectangle(50,50,150,150,RGB(0,0,255))
 

DrawText() [Version 2.0 and above]

Draw text on form screen using the specified font.


Syntax
DrawText(x1,y1,text,textColor,backColor,font)


Arguments

X1,y1: specify the x,y coordinate of the text to be drawn.
Text: text to be drawn.
TextColor: specify the RGB color of the text.
BackColor: specify the background color.
If you omit this argument, DrawText() will draw the text in transparent mode.
Font: specify a variable that contains a font handler.
The font handler can be obtained by using the CreateFont() function.
If you omit this argument, DrawText() will use the form's default font to draw text.


Example

[OnPaint event of main form]
Dim(font)
SetVar(@font, CreateFont("Tahoma",20,"bold+italic") )
DrawText(10,10,"Hello!",RGB(255,0,0),RGB(0,255,0),@font)
DrawText(10,50,"Transparent!",RGB(255,0,0),,@font)
 

DUpdateRecord (fieldvalues,domain,criteria,confirmation)

Updates records in a table with new values that meet the criteria.

 

Arguments

Fieldvalues: (field1=value1[,field2=value2,…])
The names of the fields that are updated and their new values.

Domain: The name of the table in which records are updated with new values.
Criteria: An optional expression used to restrict the range of data on which a DUpdateRecord action is performed. Criteria is equivalent to the WHERE clause in an SQL expression, without the word WHERE.

If criteria is omitted, the DUpdateRecord action updates all records in the table.

Confirmation: Display a confirmation dialog box before updating records. To disable the confirmation dialog box, set it to No.

 

Examples 

DUpdateRecord (OrderDetails.UnitPrice=34.45,OrderDetails,OrderDetails.ProductID=3)
DUpdateRecord((OrderDetails.UnitPrice=34.45,OrderDetails.Discount=0.01), OrderDetails,OrderDetails.ProductID=&prodct)
 

DuplicateRecord (form,sourceRecord) [Version 2.0 and above]

Creates a duplicate of a specified record.

 

Arguments

Form: a Main/Subform.
SourceRecord
: Specifies the record(record number) to be duplicated. If SourceRecord is omitted, DuplicateRecord() duplicates the current record of the specified Main/Subform.

 

Examples 

DuplicateRecord(MainForm, 100)
DuplicateRecord( Subform1 )
 

 

ExecMacro (Command) [Version 1.7 and above]

Executes a set of one or more macro actions.

 

Arguments

Command: a set of one or more actions.

 

Examples

ExecMacro("Dim(var1)\r\nSetVar(@var1,&control1)\r\nMsgBox(@var1)")

ExecMacro(!0!table1.fldMacro)

Note: Each macro action should be delimited by newline. (\r\n).

<Top>
 

ExportToCSV() [Version 2.0 and above]

Export specified record set to a CSV file.


Syntax
ExportToCSV(sourceSql,destination,separator,quotationMark,datetimeFormat,fieldName)


Arguments

SourceSQL: specify a SQL statement as the source record set.
Destination: the full path and name of the destination file.
Separator: field separator. __Comma, __Tab, __Semicolon, __Space
Quotation Mark: quotation marks to enclose text field. __DoubleQuotation, __SingleQuotation, __None
DatetimeFormat: date time format for dateTime field.
FieldName: __Yes to store field names in the first line of the .csv file, else __No.


Example

ExportToCSV("SELECT * FROM Table1","\My Documents\1.csv",__Comma,__DoubleQuotation, __DefaultDateTimeFormat,__Yes)
ExportToCSV("SELECT * FROM Table1","\My Documents\1.csv",__Comma,"__DoubleQuotation, "mm/dd/yyyy",__No)
 

FindNext ()

Finds the next record that meets the criteria specified by the previous FindRecord action.
 

FindRecord (main/subform,findWhat,searchField,match,matchCase,search,findFirst)

Finds the first instance of data than meets the criteria specified by the arguments.

 

Arguments

Main/Subform:

FindWhat:  The data you want to find in the record.
SearchField:  A field you want to search. Omit this argument to search whole fields in a table.
Match: Specifies where the data is located in the field.
Anywhere – For data in any part of the field.
Entire – For data that fills the entire field.
Start – For data located at the beginning of the field.
MatchCase: Specifies whether the search is case-sensitive.
Yes – Case-sensitive search.
No – Search without matching uppercase and lowercase letters exactly.

Search: Up - the search proceeds from the current record up to the beginning of the records
Down - Search proceeds from the current record down to the end of the records
SearchAll - Search proceeds from the current record down to the end of the records and then from the beginning of the records to the current record, so all records are searched.
FindFirst: Yes - the search starts at the first record.
No – The search starts at the current record.

 

Examples 

FindRecord (MainForm,"k-",OrderID.ShipName,Start,No,SearchAll,Yes)
FindRecord (MainForm,&shipname,OrderID.ShipName,Anywhere,No,SearchAll,No)

FindRecord (MainForm,,OrderID.ShipName,Start,No,SearchAll,Yes)

< Top>
 

FirstRecord (main/subform)

Go to the first record, and make the first record the current record in a main/subform.

 

Argument

Main/subform:

 

Examples 

FirstRecord (MainForm)
FirstRecord (SubForm1)
 

GotoRecord (Main/Subform, Record)

Go to the specified record and make the record the current in a Main/Subform.

 

Argument

Main/Subform
Record: The record number.

 

Example

GotoRecord (MainForm, 100)
 

ImportFromCSV() [Version 2.0 and above]

Import records from specified .csv file into an existing table.


Syntax
ImportFromCSV(sourceCSV,destination,separator, quotationMark,datetimeFormat,fieldname)


Arguments

SourceCSV: specify the source .csv file.
Destination: name of the destination table. The table must be an existing table.
Separator: field separator. __Comma, __Tab, __SemmiColon, __Space
QuotationMark: quotation marks to enclose text field. __DoubleQuotation, __SingleQuotation, __None
DatetimeFormat: date time format for dateTime field.
FieldName: if field names are stored in the first line of the .csv file __Yes,, else __No.


Example

ImportFromCSV("\My Documents\1.csv",Table1,__Comma,__DoubleQuotation, __DefaultDateTimeFormat,__Yes)
 

KillTimer (timerID) [Version 1.5 and above]

Kills the timer event identified by timerID from the earlier call to SetTimer.

 

Argument

timerID:

 

Example

KillTimer (1)

 

See also SetTimer()

<Top>
 

LastRecord (Main/Subform)

Goto the last record, and make the last record the current record in a Main/Subform.

 

Argument

Main/Subform:

 

Examples 

LastRecord (MainForm)
LastRecord (SubForm1)
 

MoveControl (control,left,top,width,height) [Version 1.7 and above]

Moves/resizes a control.

 

Arguments

Control: The name of the control you want to move/resize.
Left:   The new position of the left side of the control, in pixel.
Top:  The new position of the top of the control, in pixel.
Width: The new width of the control, in pixel.
Height: The new height of the control, in pixel.

 

Remarks
To keep the current position or dimensions, leave the arguments blank.

 

Examples 

MoveControl (&control1, 0, 10, , )
MoveControl (&control1, , , 100, 50)
 

MsgBeep (SoundType)

Beeps a sound.

 

Argument

SoundType: The sound type. One of the available sounds: "Default", "Exclamation".

<Top>
 

MsgBox (message, title, type)

Displays a message box, waits for the user to click a button, and returns an integer indicating which button the user clicked.

 

Arguments

Message: A string expression displayed as the message in the dialog box.
Title:  A string expression displayed in the title bar of the dialog box.
Type:  The type of buttons to display.
OK – One button "OK".
YESNO – Two buttons "YES" and "NO".
"YES" returns 1, "NO" returns 0.

 

Examples 

MsgBox ("Delete this customer: "+&customer+"?", "Warning", YESNO)
MsgBox ("Please enter a value first.", "MyProg", OK)
 

NextRecord (main/subform)

Goto the next reocrd, and make the next record the current record in a main/subform.

 

Argument

Main/Subform:

 

Examples 

NextRecord (MainForm)
NextRecord (SubForm1)
 

OpenQuery (Query, DataMode) [Version 1.7 and above]

Opens a query in the table view.

 

Arguments

Query
: The name of the query. Also you can specify a SQL-SELECT statement instead of a query name.

DataMode: The data entry mode for the query.

Edit: The user can edit existing records and add new records.

ReadOnly: the user can only view records.

<Top>
 

PlaySound (WaveFile, flag) [Version 1.5 and Above]

Plays the specified wave file.

 

Arguments

WaveFile: the full path of a wave file.
flag: Async - plays synchronously and return immediately.
Sync: returns after the sound completes.
Loop: plays the sound repeatedly.

 

Example

PlaySound ("\My Documents\sound1.wav",Loop)
 

PolContactAdd() [Version 2.0 and above]

Add a new contact in Pocket Outlook Contact Database.


Example

//create a new contact in the Pocket Outlook Contact database.

PolContactAdd()

//Retrieve the object identifier for the newly created item.

Dim( oid )
SetVar(@oid, PolContactOID() )

//Set the first name and last name for the contact.
PolContactWrite( @oid, "FirstName", &edit1 )
PolContactWrite( @oid, "LastName", &edit2 )

 

See also PolContactOID() function.
 

PolContactDelete(oid) [Version 2.0 and above]

Delete a contact in Pocket Outlook Contact Database.


Arguments

oid: Object identifier for an item.

Example

//Retrieve the object identifier for the current item.

Dim(oid)
SetVar(@oid, PolContactOID() )

//Delete the current item.
PolContactDelete( @oid )

 

See also PolContactOID().
 

PolContactFind(restriction) [Version 2.0 and above]

Find the first item in contact database.


Arguments

Restriction: A restriction string that defines which items to find. This must contain a boolean expression that evaluates to TRUE or FALSE for any item. Enclose column names between brackets([ and ]). You can combine expressions with AND and OR. Comparison operators are the following: <, <=, >, >=, = or <>.

 

Refer to the available columns section.


Example

PolContactSort("[FirstName]", Ascending )

PolContactFind('[FirstName]>="c"')

Dim(oid)
SetVar(@oid, PolContactOID() )
Dim( fname )
SetVar( @fname, PolContactRead(@oid,"FirstName") )

 

See also PolContactRead().
 

PolContactFindNext() [Version 2.0 and above]

Find subsequent items in contact database.

Example

PolContactSort("[FirstName]", Ascending )

PolContactFind('[FirstName]>="c"')

...

Dim(oid)

Dim(fname)
PolContactFindNext()
SetVar(@oid, PolContactOID() )
If( @oid=0 )
EndMacro()
EndIf
SetVar( @fname, PolContactRead(@oid,"FirstName") )

See also PolContactRead().

 

PolContactSort(column,order) [Version 2.0 and above]

Sort on a column in contact database.

Arguments

Column: Specify a column name on which to sort. Enclose column name between brackets([ and ]). Refer to the available columns section

Order: Sort order. One of ascending / descending.


Example

Dim(oid)
PolContactSort("[FirstName]", Ascending )
PolContactFind('[FirstName]>="c"')
SetVar(@oid, PolContactOID() )
Dim( fname )
SetVar( @fname, PolContactRead(@oid,"FirstName") )

PolContactWrite(oid,column,value) [Version 2.0 and above]

Set a column in specified contact in contact database.

Arguments:

Oid: Object identifier for an item.
Column: Specify a column. Refer to the available columns section.
Value: Specify a value to set the column.

 

Example

//create a new contact in the Pocket Outlook Contact database.

PolContactAdd()

//Retrieve the object identifier for the newly created item.

Dim( oid )
SetVar(@oid, PolContactOID() )

//Set the first name and last name for the contact.
PolContactWrite( @oid, "FirstName", &editFirstName )
PolContactWrite( @oid, "LastName", &editLastName )

 

PrevRecord (main/subform)

Go to the previous reocrd, and make the previous record the current record in a Main/Subform.

 

Argument

Main/Subform:

 

Examples

PrevRecord (MainForm)
PrevRecord (SubForm1)
 

PrintForm (PrintAsImage) [SprintDB Pro + Printing version only]

Prints the current form.

 

Arguments

PrintAsImage: Yes - prints a screen-shot of the current form.
No - prints the current form. This does not support tab control.

 

Example

PrintForm (No)

<Top>
 

Quit() [Version 1.5 and Above]

Quits SprintDB Pro.
This saves changes in your form first, then directs SprintDB Pro to quit.
 

Recalc ()

Recalculates all calculated controls.
 

RequeryControl (control)

Requeries the specified control.

 

Argument

control: The name of the control you want to update.

 

Example

RequeryControl ( &edit1 )
 

 

RequeryForm (main/subform)

Updates a Main/Subform and its child form by requerying the form's record source.

 

Argument

Main/Subform
 

RunApp (appPath [,parameter]) [Version 1.5 and above]

Executes an external program.

 

Argument

AppPath: a string expression that specifies the name of the executable file.
parameter: a string expression that contains the application parameters.

 

Examples

RunApp ("calc.exe")
RunApp ("pword.exe", &wordfile)
 

RunSQL (SQLstatement, ErrMsg ) [Version 1.7 and above]

Runs a data-definition query.

 

Arguments

SQLstatement: a data-definition query like "CREATE TABLE", "ALTER TABLE".
For more information about SQL statements supported in ADOCE, see Supported SQL Statements.

ErrMsg: Specifies whether or not to display a error message if an error occurs.

 

Examples

RunSQL( "CREATE TABLE myTable1 (ID Integer, nameField Varchar(20), isMarried Bit, notesField Text)" )

RunSQL( "DROP TABLE myTable1" )

<Top>
 

Save ()

Updates the current record in the underlying table with your changes on a form.

Remarks
Normally, you don't need to use the Save () action.

SprintDB Pro updates the underlying table with your changes automatically.
 

SaveScribble (ScribbleControl, filePath, format) [Version 1.5 and above]

Saves a scribble in BMP or JPG format.

 

Arguments

scribbleControl: the name of the scribble control.
filePath: specifies the full path of the file to which you want to save the scribble.

format: Specifies the format in which the scribble is saved.

 

Examples

SaveScribble (&scribble1, "\My Documents\save1.bmp")
SaveScribble (&scribble1, "\My Documents\save1.jpg")
 

ScrollScreen (Direction, Pixel) [Version 1.7 and above]

Scrolls the contents of the current form screen.

 

Arguments

Direction: scroll direction. "Left","Right","Up","Down"
Pixel: specifies the scroll amount in pixel.

 

Example
ScrollScreen(Left,240)

<Top>
 

SetClipboard (expression)

Places data on the system clipboard in text format.

 

Argument

Expression: A string expression to be set into the clipboard.

 

Example

SetClipboard (!Customers.CompanyName + ": " + !Customers.ContactName)
 

SetComboSource (control, expression)

Sets the RowSource of a combo box.

 

Argument

Control: The name of the combo box.
Expression: A SQL query statement as the RowSource.

Remarks

The ColumnCount, BoundColumn and VisibleColumn properties of the ComboBox must be set properly in the Form edit mode.

 

Example 

SetComboSource (&combo1, {"SELECT Products.ProductID, Products.ProductName FROM Products "})

<Top>
 

SetControl (control, expression)

Sets the value of a control or the value of a property of the control.

 

Argument

Control: The name of the control or name of a property of the control.
Expression: An expression to set the value.

 

Remarks
Control Properties:

BackColor:  The background color of the control.
Border:  1 – display the control with border, 0 – without border.
FontBold: 1 – bold font, 0 – normal.
FontItalic:  1 – italic font, 0 – normal.
FontName:  The name of the font.
FontSize:  The font size in pixel.
FontStrikeOut: 1 – strikeout font, 0 – normal.
FontUnderline: 1 – underlined font, 0 – normal.
ForeColor: The foreground color used to display text.
Height:  The height of the control in pixel.
Left:   The position of the left side of the control, in pixel.
Locked: 1 – editable control, 0 – readonly control.
Top:   The position of the top of the control, in pixel.
Visible:  1 – visible control, 0 – hidden control.
Width:  The width of the control in pixel.

 

For detailed information see Control Properties.

 

Examples 

SetControl (&control1, &control2 * OrderDetails.UnitPrice )
SetControl (&control1.Visible, 1)
 

SetFocus (Control,CursorPos)

Moves the input focus to the specified control

 

Argument

Control: The name of the control.

CursorPos: Specifies the cursor position in the control.

"First" - Position the cursor at the beginning of any text in the control.

"Last" - Position the cursor at the end of any text in the control.

"SelAll" -  Select all the text in the control and position the cursor at the end of the control.

SetFormSource (main/subform,query)

Sets the RecordSource of a Main/SubForm.

 

Argument

Main/Subform:

Query: A SQL query statement as the RecordSource.

 

Examples  

SetFormSource (MainForm,{"SELECT * FROM Orders WHERE Orders.Customer=&customer_combo"})
SetFormSource (SubForm1,{"SELECT * FROM OrderDetails WHERE OrderDetails.OrderID=!0!Orders.OrderID"})

<Top>
 

SetListSource (Control,Query)

Refreshes the list control with data from the query.

 

Argument

Control: The name of the list control.
Query:  A SQL query statement as the data source.

 

Example  

SetListSource (&listControl1, {"SELECT * FROM Product WHERE Product.ProductID=&productControl"})
 

SetRegistryInt (section, entry, value)

Sets the specified value into the specified registry entry under:

HKEY_CURRENT_USER\Software\SprintDB Pro\UserData

 

Arguments

Section: A string expression that specifies the section containing the entry.
Entry: A string expression that specifies the entry into which the value is to be written.
Value: A number expression that specifies the value to be written.

 

Example

SetRegistryInt( "myConfig", "showInterval", &secondsControl*1000 )
 

SetRegistryStr (section, entry, value)

Sets the specified value into the specified registry entry under:

HKEY_CURRENT_USER\Software\SprintDB Pro\UserData

 

Arguments

Section : a string expression that specifies the section containing the entry.
Entry: a string expression that specifies the entry into which the value is to be written.
Value: a string expression that specifies the value to be written.

 

Example

SetRegistryStr( "myConfig", "bmpPathName", "\My Documents\"+&fileName )
 

SetTimer (timerID, elapse) [Version 1.5 and above]

Installs a Timer.

 

Arguments

TimerID: Timer identifier in number.
Elapse: The time-out value in milliseconds.

 

Example

SetTimer( 1, 1000 )

 

See also KillTimer()
 

SetZOrder (control, zorder ) [Version 1.6 and above]

Brings the specified control to the front of the z-order, or sends the control to the back of the z-order.

 

Argument

Control: The name of the control.

Zorder:
Top
- Brings the specified control to the front of the z-order.
Bottom - Sends the control to the back of the z-order.

 

Examples

SetZOrder( &control1, Top )

SetZOrder( &control1, Bottom )
 

ShowInputPanel (Show) [Version 1.5 and above]

Shows/Hides the currently active Software Input Panel [SIP].

 

Arguments

Show:
"Show" - shows the SIP.
"Hide" - hides the SIP.

 

Example

ShowInputPanel( Show )
 

ShowScrollBar (ScrollBar, Show/Hide) [Version 1.7a and above]

Shows/Hides the Form's ScrollBar(s).

ScrollBar Type: Vertical or Horizontal

Arguments

Show:
"Show" - shows the ScrollBar Type.
"Hide" - hides the ScrollBar Type.

 

Examples

ShowScrollBar(Vertical, Show)
ShowScrollBar(Horizontal, Hide)


 

ShowWaitCursor (Show/Hide) [Version 2.1 and above]

Shows/Hides an hourglass icon.

 

Arguments

Show:
"Show" - shows an hourglass icon.
"Hide" - hides an hourglass icon.

 

Examples

ShowWaitCursor(Show)
ShowWaitCursor(Hide)
 

 

StopSound () [Version 1.5 and above]

Stops any currently playing waveform sound.

 

Example

StopSound()
 

TreeDeleteItem() [Version 2.0 and above]

Delete an item(s) in a tree control.


Syntax
TreeDeleteItem(control,itemID)

Arguments

Control: Specify a tree control.
ItemID: Item id of an tree item. You can retrieve an item ID by using the tree control's ItemID() or RootItemID() property.

If you omit this argument, TreeDeleteItem() will delete all items.

Example

Dim(Tid)
SetVar(@Tid,&tree1.ItemID())
TreeDeleteItem(&tree1,@Tid)
 

TreeDeleteItemEx() [Version 2.1 and above]

Delete an item(s) in a tree control.


Syntax
TreeDeleteItemEx(control, IID)

Arguments

Control: Specify a tree control.
IID: Item id of an tree item. IID should be the item ID set by using TreeInsertItemEx() or TreeSetItemIDEx().

If you omit this argument, TreeDeleteItemEx() will delete all items.

Example

TreeInsertItemEx( &tree1,,1, "item1" )
TreeInsertItemEx( &tree1,,2, "item1" )

...
TreeDeleteItemEx( &tree1, 2)
 

TreeInsertItem() [Version 2.0 and above]

Insert a new item in a tree control.

Syntax
TreeInsertItem(control,itemID,text)

Arguments

Control: Specify a tree control.
ItemID: Item id of the inserted item's parent. You can retrieve an item ID by using the tree control's ItemID() or RootItemID() property. To insert root items, omit this argument.
Text: Specify the inserted item's text.

Example

TreeInsertItem(&tree1, ,"Root Item1")
Dim(Tid)
SetVar(@Tid,&tree1.RootItemID())
TreeInsertItem(&tree1,@Tid,L"Child Item1")
TreeInsertItem(&tree1,@Tid,L"Child Item2")
 

TreeInsertItemEx() [Version 2.1 and above]

Insert a new item in a tree control.

Syntax
TreeInsertItemEx(control,PID,IID,text)

Arguments

Control: Specify a tree control.

PID: Item id of the inserted item's parent. If this argument is omitted, the item is added as a root item. PID should be the item ID set by using TreeInsertItemEx() or TreeSetItemIDEx().

IID: Specify item id of the new item.
Text: Specify the new item's text.

Example

TreeInsertItemEx(&tree1,  , 1, "Item1")
TreeInsertItemEx(&tree1,  , 2, "Item2")

TreeInsertItemEx(&tree1, 1, 11, "Item1-1")

TreeInsertItemEx(&tree1, 1, 12, "Item1-2")

TreeInsertItemEx(&tree1, 2, 21, "Item2-1")

TreeInsertItemEx(&tree1, 12, 121, "Item1-2-1")

 

 

TreeSetItem() [Version 2.0 and above]

Set the text of the specified tree item.

Syntax
TreeSetItem(control,itemID,text)

Arguments

Control: Specify a tree control.
ItemID: Item id of an tree item. You can retrieve an item ID by using the tree control's ItemID() or RootItemID() property.
Text: Specify the new item's text.

Example

Dim(Tid)
SetVar(@Tid,&tree1.ItemID())
TreeSetItem(&tree1,@Tid,"Selected!")
 

TreeSetItemEx() [Version 2.1 and above]

Set the text of the specified tree item.

Syntax
TreeSetItemEx(control,IID,text)

Arguments

Control: Specify a tree control.
IID: Item id of an tree item. IID should be the item ID set by using TreeInsertItemEx() or TreeSetItemIDEx().
Text: Specify the new item's text.

Example

TreeInsertItemEx(&tree1,  , 1, "Item1")
TreeInsertItemEx(&tree1,  , 2, "Item2")

TreeSetItemEx(&tree1, 1, "Root Item 1")
TreeSetItemEx(&tree1, 2, "Root Item 2")
 

TreeSetItemIDEx() [Version 2.1 and above]

Set item ID of the specified tree item.

Syntax
TreeSetItemIDEx(control, IID, newIID)

Arguments

Control: Specify a tree control.
IID: Item id of an tree item. IID should be the item ID set by using TreeInsertItemEx() or TreeSetItemIDEx().
newIID: Specify new item ID of the tree item.


Example

TreeInsertItemEx(&tree1,  , 1, "Item1")
TreeInsertItemEx(&tree1,  , 2, "Item2")

TreeSetItemIDEx(&tree1, 1, 10)

TreeSetItemIDEx(&tree1, 2, 20)

TreeSetItemEx(&tree1, 10, "Root Item 1")
TreeSetItemEx(&tree1, 20, "Root Item 2")
 

 

TreeSortItem () [Version 2.0 and above]

Sort the child items of the given parent item in a tree control.
 

Syntax
TreeSortItem(control, ItemID)


Arguments

Control: Specify a tree control.
ItemID: ID of the parent item whose child items are to be sorted. You can retrieve an item ID by using the tree control's ItemID() or RootItemID() property.
If this argument is omitted, sorting will proceed from the root of the tree.

Example

Dim(Tid)
SetVar(@Tid,&tree1.ItemID())
TreeSortItem(&tree1,@Tid)
 

TreeSortItemEx () [Version 2.1 and above]

Sort the child items of the given parent item in a tree control.

 

Syntax
TreeSortItemEx(control, IID)

Arguments

Control: Specify a tree control.
IID: Item ID of the parent item whose child items are to be sorted. IID should be the item ID set by using TreeInsertItemEx() or TreeSetItemIDEx(). If this argument is omitted, sorting will proceed from the root of the tree.

Example

TreeInsertItemEx(&tree1,  , 1, "Europe")
TreeInsertItemEx(&tree1,  , 2, "Asia")

TreeInsertItemEx(&tree1, 2, 21, "Japan")

TreeInsertItemEx(&tree1, 2, 22, "Korea")

TreeInsertItemEx(&tree1, 2, 23, "China")

TreeSortItemEx(&tree1, 2)
 

 

UpdateAll (Main/Subform,Field,Value,Confirmation)

Updates all records in the current record set of a Main/SubForm with the specified value.

 

Argument

Main/Subform: 

Field:  The name of the field you want to update
Value:  A value expression.

Confirmation:  Display a confirmation dialog box before updating records. To disable the confirmation dialog box, set it to No.
 

UpdateRecord (Main/Subform,Field,Value)

Updates a field in the current record with the specified value.

 

Argument

Main/Subform: 

Field:   The name of the field you want to update
Value:  A value expression.

 

Examples 

UpdateRecord (MainForm, Table1.Remark, !Table1.Field1+&control1)
UpdateRecord (SubForm1, Table2.Field1, !0!Table1.Field3 * 2.3 )
 

If (ConditionExpression)...ElseIf (ConditionExpression)...ElseEndIf

You can use a conditional expression to determine whether in some cases an action will be carried out when a macro runs.

 

Argument

ConditionExpression: An expression that evaluates to true or false. You can use any combination of comparison operator (<,>,<=,>=,=,<>) and logical operator( AND, OR, NOT ).

Remarks

Nested If…EndIf is not allowed.

Examples  

If (&comboBoxControl="" )
MsgBox ("Please choose a criteria first!","Warning",OK)
EndMacro ()
ElseIf (&comboBoxControl="Completed" )
SetFormSource (SubForm2,{"SELECT * FROM Tasks WHERE Tasks.Completed=1"})

Else
SetFormSource (SubForm2,{"SELECT * FROM Tasks "})
EndIf
 

DoWhile (Condition)…EndDoWhile

Executes a series of macro actions as long as a given condition is true.

 

Examples

Dim (varA)
Dim (result)
SetVar (@varA,1) 
SetVar (@result,1)
DoWhile (@varA<=5 )
SetVar (@result, @result*@varA)
SetVar (@varA, @varA+1)
EndDoWhile ()
MsgBox ("Result = "+@result, "factorial of "+(@varA-1),OK)
 

Dim (Variable)

Declares a local variable.

Local variables are available only within the macro/event procedure in which they are declared.

 

Argument

Variable: The name of the variable

Remarks

The variable can contain any supported data type.
The value of the variable is NULL before you assign a value.
So you should assign a proper value before using the variable.

Examples

Dim (varStr)
Dim (varInt)

SetVar (@varStr, "hello!" )
SetVar (@varInt, 5+4 )
 

GlobalDim (Variable)

Declares a global variable.

Global variables are available to all the macro/event procedure in the form they are declared, but not to other form.

 

Argument

Variable: The name of the variable

Remarks

The variable can contain any supported data type.
The value of the variable is NULL before you assign a value.
So you should assign a proper value before using the variable.

Examples

GlobalDim (gvarStr)
GlobalDim (gvarInt)

SetVar (@gvarStr, "hello!" )
SetVar (@gvarInt, 5+4 )
 

 

SetVar (Variable,Value)

Assigns a value to a variable.

 

Argument

Variable: The name of the variable
Value:     A value expression.

 

Examples

Dim (varA)
Dim (varB)
SetVar (@varA, @varA + 100)
SetVar (@varB, &control1 + ", and " + !Table1.Field1)
 

EndMacro ()

Stops the currently running macro.

 

Example

If (!Table1.Field1<=!Table1.Field2 )
MsgBox ("Field1 must be greater than Field2","Warning",OK)
EndMacro ()
Else

<Top>