Solved

Problem passing an integer to a Filter in Access 2010 VBA

Posted on 2013-06-29
2
937 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

738 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