home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 November
/
Pcwk1197.iso
/
LOTUS
/
Eng-ins
/
SAMPLES
/
SUITE
/
DW08_S2.APR
/
SCRIPT
/
ApproachDoc
/
Employee
/
Body
/
btnLast.s
(
.txt
)
< prev
next >
Wrap
Null Bytes Alternating
|
1996-10-27
|
5KB
|
57 lines
'++LotusScript Development Environment:2:5:(Options):0:66
'++LotusScript Development Environment:2:5:(Forward):0:1
Declare Sub Click(Source As Button, X As Long, Y As Long, Flags As Long)
'++LotusScript Development Environment:2:5:(Declarations):0:2
'++LotusScript Development Environment:2:2:BindEvents:1:129
Private Sub BindEvents(Byval Objectname_ As String)
Static Source As BUTTON
Set Source = Bind(Objectname_)
On Event Click From Source Call Click
End Sub
'++LotusScript Development Environment:2:2:Click:1:12
Sub Click(Source As Button, X As Long, Y As Long, Flags As Long)
'Click event for btnLast object.
'Applies the Find and Sort objects to the DocWindow
'using the FindSort method. It prompts the user to enter an employee's
'last name and starts searching after the user enters the info.
' * Objects: You must have these objects to run this script:
' * Worksheet object named Worksheet 1
' * Files: The main table for the current .APR must have
' * fields named "ID", "Last", and "First".
'Create a DocWindow object.
Dim MyDocWin As DocWindow
'Retrieve the active DocWindow.
Set MyDocWin = CurrentApplication.ActiveDocWindow
'Create a Table object.
Dim MyTable As String
'Retrieve the name of the main table for the view.
MyTable = CurrentDocument.Tables(0).TableName
'Collect the find conditions from the user and use them to build
'a find object.
Dim Criteria As String 'Store input from the user
'Prompt user to enter employee's last name.
Criteria = Inputbox$("Enter employee's last name", , ,300,300)
'Find records that match the user's input.
'Create new instance of Find object to search by input last name
Dim FindLast As New Find (MyTable & ".Last", Criteria)
'Create new instance of Sort object, sorted by last name.
'The constant LtsSortAscending indicates the sort direction.
Dim MySort As New Sort (MyTable & ".last", LTSSORTASCENDING)
'Also sort by first name in ascending order
Call MySort.Add (MyTable & ".First", LTSSORTASCENDING)
'Find last name based on user's input, sorted by ascending order.
'Sort is optional
Call MyDocWin.FindSort (FindLast, MySort)
'Show the find results in the worksheet view
Set CurrentWindow.ActiveView = CurrentDocument.Worksheet~ 1
End Sub 'Click event, btnLast object