A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

how do I make a customer search like northwind?



 
 
Thread Tools Display Modes
  #1  
Old October 6th, 2006, 01:58 AM posted to microsoft.public.access.forms
PeteL
external usenet poster
 
Posts: 2
Default 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  
Old October 6th, 2006, 02:49 AM posted to microsoft.public.access.forms
Duane Hookom
external usenet poster
 
Posts: 2,251
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:17 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.