Alphabetical record navigation on mouse up event of label

etalent

Registered User.
Local time
Today, 01:37
Joined
Mar 17, 2004
Messages
10
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, but that still makes it too big to attach. Please let me send it to you!

Thanks,
- Dave
 
Dave, I have your form. Its a modified "Smart Form". I will isolate the table and form into a new DB and attach it to another reply. Hold On.
 
Sounds like you want to FILTER your data based on the first letter of the field. This should get you started...
Code:
Private Sub btnA_Click()

    Me.FilterOn = True
    DoCmd.ApplyFilter , "fldInfEng like 'A*'"

End Sub

Private Sub btnB_Click()

    Me.FilterOn = True
    DoCmd.ApplyFilter , "fldInfEng like 'B*'"

End Sub
 
Works!!! Thank You!!

ghudson said:
Sounds like you want to FILTER your data based on the first letter of the field. This should get you started...
Code:
Private Sub btnA_Click()

    Me.FilterOn = True
    DoCmd.ApplyFilter , "fldInfEng like 'A*'"

End Sub

Private Sub btnB_Click()

    Me.FilterOn = True
    DoCmd.ApplyFilter , "fldInfEng like 'B*'"

End Sub



So elegantly simple! Oh to do what you can!

Thanks millions! I'm psyched now!!!!!
 
Here ya are

A couple of notes. I have modified the (*) new record button to lock the form in a continuous data entry mode. This is not a change in the form properties, I just force .NewRecord. I attached, BillsUtils module which includes utilities to: correct the punctuation of an address string, correct the punctuation of a proper name. User can type without punctuating these entries and they will be corrected before the record updates.
This form DOES NOT filter the data - it slews to the first occurance of the selected letter (in my case, last name 1st letter). If there is no occurance, a msg box so indicates.

OK I just realized my striped down db is 122kb, 22kb too big. Can I email it to you? Send me a private message via this forum.
 
Last edited:
etalent said:
So elegantly simple! Oh to do what you can!

Thanks millions! I'm psyched now!!!!!
Your welcome!

I do suggest that you verify that there are records to filter or else your form will appear blank if the selected filter option returns zero records. This should get you on the right track to test that at least once record will show when filtered for that letter...
Code:
    If DCount("[fldInfEng]", "tblInfinitives", "[fldInfEng] like 'A*'") = 0 Then
        MsgBox "There is nothing to filter since there are no records that begin with an A."
        Me.FilterOn = False
        Exit Sub
    Else
        Me.FilterOn = True
        DoCmd.ApplyFilter , "fldInfEng like 'A*'"
    End If
 

Users who are viewing this thread

Back
Top Bottom