Solved

Problem passing an integer to a Filter in Access 2010 VBA

Posted on 2013-06-29
2
953 Views
Last Modified: 2013-06-29
I am having a problem applying a filter of a form using a dropdown with the following code

Private Sub ActionFilter_AfterUpdate()
Dim intActionTypeID As Integer


intActionTypeID = Me.ActionFilter.Column(0)

MsgBox strActionTypeID  '(just put this here to check integer is correct)


Me.Filter = "[ActionTypeID] = '" & strActionTypeID & "'"

Me.FilterOn = True
End Sub

Open in new window


It appears the value (1) is being passed, but I get the message "The search key was not found in any record", so I am assuming the problem is in ... '" & strActionTypeID & "'", but I can't work out what it is. If I use Me.Filter = "[ActionTypeID] = 1" then it works.

Can anyone help before I jump out the Window?
0
Comment
Question by:martmac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 39286544
If the field ActionTypeID is a number field then you do not want the ' '.

Me.Filter = "[ActionTypeID] = " & strActionTypeID
0
 

Author Closing Comment

by:martmac
ID: 39286627
Bingo, thanks so much, that's done the trick.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question