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!

Alpha name search Access 2007

Status
Not open for further replies.

kattzndagz

Technical User
Sep 20, 2007
13
AU
Hi everyone
I have Access 2007 and I read somewhere that it is better to use code (which is Modules?)

I don't know much about code (as I have always used Macros) and I have a form which has a-z buttons to search for employees (from an old version of Access)

What i would like to know is - what is the code for the old Name.Alpha macros?

I only need one for one letter then I can obviously duplicate it, but also need one for "All" and if there are "no results"

Also does anyone know where i can find a list of basic module code eg exit,next record, open form - all the basic request really - or even something that will help me learn.

Thanks in advance [bigsmile]
 
I believe you can convert macros to code from a menu in Access 2007.
I would set up the a-z buttons as an option group with toggle buttons having captions A - Z and values 1 - 26. You can then use code like:
Code:
Private Sub fraLetter_AfterUpdate()
    Dim strLetter As String
[green]    'the letter A has a CHR() value of 65[/green]
    strLetter = Chr(Me.fraLetter.Value + 64)
    MsgBox "You selected the letter " & strLetter & ".", vbInformation + vbOKOnly, "Selected Letter"
End Sub
You will need to modify the code to either find or filter the records.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top