If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
how do I make a customer search like northwind?
I copied the form and the macro into my database but cant get it to work.
|
#2
|
|||
|
|||
how do I make a customer search like northwind?
You can replace all the buttons and macro with a single, wide command button
and a little code. 1) Create a continuous form for the customers table and display the form header and footer sections. 2) Turn off the tool box wizard and add a command button to the footer section making it about as wide as the form 3) Set the font to fairly large and set the caption to "All" 4) Name the command button "cmdIndex" and set its mouse move event to: Private Sub cmdIndex_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim strChar As String strChar = Chr(65 + Int((X / Me.cmdIndex.Width) * 27)) If strChar = "[" Then strChar = "All" End If Me.cmdIndex.Caption = strChar End Sub 5) compile the code and view the form in form view while moving your mouse from left to right over the button The caption should change from "A" to "Z" to "All" 6) Go back to the code window and set the On Click event of cmdIndex to: Private Sub cmdIndex_Click() If Me.cmdIndex.Caption "All" Then Me.Filter = "Left([CompanyName],1) ='" & _ Me.cmdIndex.Caption & "'" Me.FilterOn = True Else Me.FilterOn = False End If End Sub 7) Compile and save the form. The single command button should now allow you to filter the form records. -- Duane Hookom MS Access MVP "PeteL" wrote in message ... I copied the form and the macro into my database but cant get it to work. |
Thread Tools | |
Display Modes | |
|
|