Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / January 2007

Tip: Looking for answers? Try searching our database.

Apply filter based on the value of a field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sandy - 31 Jan 2007 18:35 GMT
Hello -

I have the following Procedure:

Private Sub Course_IDFilter_Exit(Cancel As Integer)
Dim StringWhere As String           'The criteria string.
Dim lngLen As Long                      'Length of the criteria string to
append to.
     

    Me.Filter = "[Course_ID]=[Course_IDFilter]"
    Me.FilterOn = True

End Sub

The objective is to apply a filter to the data in the detail section of a
form for all records with [Course_ID] = to the number in the unbound
[Course_IDFilter] field after a course ID is entered into it.

The filter works, but I get an "Enter Parameter Value" window that asks me
to enter the [Course_IDFilter] value again.

What have I missed?

many thanks
sandy
Sprinks - 31 Jan 2007 20:21 GMT
Sandy,

You are mixing a string literal with the value of either a field or control
name.  If the value in [Course_IDFilter] is a number, try:

Me.Filter = "[Course_ID] = " & [Course_IDFilter]

If the value is a string enclose the value in single quotes:

Me.Filter = "[Course_ID] = " & "'" & [Course_IDFilter] & "'"

Hope that helps.
Sprinks

> Hello -
>
[quoted text clipped - 22 lines]
> many thanks
> sandy
Sandy - 31 Jan 2007 20:24 GMT
THANK YOU!!!

> Sandy,
>
[quoted text clipped - 36 lines]
> > many thanks
> > sandy
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.