Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alphabetical record navigation on mouse up event of label

Status
Not open for further replies.

etalent

Programmer
Jun 9, 2003
23
0
0
US
I've got a table with a column of text that is sorted alphabetically. On a form I've got 26 one letter labels of "A" through "Z."

I want to click any of the letters to navigate through the alpabetically sorted records. The "on mouse up" event seems to be the most sensible event to program. How? I have no idea.

Here is an example of what I want to happen:

Table "tblInfinitives" has 35 records that are sorted alphabetically on text field "fldInfEng." Let's say that the first record starting with the letter "e" in field "fldInfEng" is "eat."

Form "frmVerbs" has on it 26 one letter labels of "A" through "Z.." If I click the "E" letter, I should be (record) navigated over to "eat."

My little database is only 219 KB. Please let me send it to you!

Thanks,
- Dave
 
Try something like this on the OnClick event of the label


Private Sub lblE_Click()
Dim rstFind As DAO.Recordset
Dim strLF As String

Set rstFind = Me.RecordsetClone
strLF = "fldInfEng Like 'E*'"
rstFind.FindFirst strLF
If rstFind.NoMatch = False Then
Me.Bookmark = rstFind.Bookmark
End If

Set rstFind = Nothing
End Sub


Of course you will need to add the DAO referances to do it this way but it works quite well.

Hope this helps.

OnTheFly
 
ive seen this done before in a contacts management database, the way it was achieved then is having 26 cmd buttons which applied a "filter" to a continous form.

But I know little about filters so thats about as far as my knowledge goes on that.

Failing that you could have a tab form, each tab being a letter of alphabet, then have a query that referenced to the label of that tab sheet to the criteria of your query
 
Hay etalent . . . . .

Emailed the corrected DB back to ya!

cal.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top