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!

Form based on Parameter Query

Status
Not open for further replies.

ghnat

MIS
Apr 8, 2003
28
0
0
CA
I have a form based on a Parameter query which displays all records for the company based on user input. I then have 26 command buttons on the form which filter passenger names within that company based on their first letter.

Private Sub P_Click()
DoCmd.ApplyFilter , "[PASSENGER] Like 'P*'"
End Sub

My trouble is that the form works totally fine in Access 2000 but when I recreate it or convert it to Access 2003 I am always prompted for the original parameter when any or all command buttons are selected. Very annoying and makes the form unusable in the 2003 state.

Any assistance would be greatly appreciated

Gary (newbie)







 
It may have something to do with VBA and References. The newer versions of Access drop or lower the importance of DAO programming.

You may need to recheck the Microsoft DAO 3.6 Object Library.
 
I went into ... View/Code/Tools/References ... to make sure it was checked ... and it was.

Still however not working properly .. have spent hours trying to get what initially seemed to be an easy issue to resolve.

The filter buttons on the form always prompts for the parameter value on the query which the form is based on .. but never did this in Access 2000

Gary
 
How are ya ghnat . . .

Try this:
[ol][li]In the code module of the form, copy/paste the following routine:
Code:
[blue]Public Sub SetFilter(Ltr As String)
   Me.FilterOn = False
   Me.Filter = "[PASSENGER] Like '" & Ltr & "*'"
   Me.FilterOn = True
End Sub[/blue]
[/li]
[li]Then call the routine from each button. Example:
Code:
[blue]Private Sub P_Click()
   call setfilter("[purple][b]P[/b][/purple]")
End Sub[/blue]
[/li][/ol]
Be sure to disable or remove your other code to prevent interaction and perform your testing . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top