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.