On-click, alphabetic letter selection. (1 Viewer)

U

uniburo

Guest
I would like to print mail-labels filtering names in ascending way.
The range of names to be printed has to be selected with a mouse-click on an alphabetic pad (e.g.: from letter "D" fist click, to letter "L" second click).
I already made a form with 26 command buttons, each containing one alphabet letter.
How can I capture the value of the clicked letter, and how to use it to select the first and the last label to print?

Thank you very much indeed.
 

Travis

Registered User.
Local time
Today, 03:00
Joined
Dec 17, 1999
Messages
1,332
On your AlphaBet form in the Declarations Section add this

Dim stFirstLetter as String
Dim stLastLetter as String

On the Buttons pressed you will have to determine if it is the first or last letter pressed. You can do this by checking if stFirstLetter is set to a valid letter between a to z: Code could look like this:

Public Sub SetLetters(stLetter as String)
If stFirstLetter >= a and stFirstLetter <=z then
If stLastLetter >= a and stLastLetter <=z then
'No Change both are set
else
stLastLetter = stLetter
End If
Else
stFirstLetter = stLetter
End if

Then when you call your report use the Where part of the OpenReport

"Left([LastName],1) Between " & stfirstLetter & " and " & stlastLetter

Hope this helps
 

Users who are viewing this thread

Top Bottom