473,395 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Filter OnLoad not working

Brilstern
208 100+
Filter OnLoad

So I know this has been explained 1000 times but for some reason I am having trouble making it work. Does this look correct? Did I miss something, I will elaborate more if I at least have got this right. As of right now my form opens to a new record every time.

Expand|Select|Wrap|Line Numbers
  1. strFilter = "[ID] =' & Me.cbxRegion & '"
  2.  
  3. DoCmd.Close acForm, "frmRegion"
  4. DoCmd.Close
  5. DoCmd.OpenForm "frmRegionEdit", , , strFilter
I have ran my string through a message box/debug and it is returning the correct value. I am only using one column, and the first column is bound.
Mar 20 '15 #1
4 1938
Brilstern
208 100+
Not sure why this works. But I made it work by changing the filter.

Expand|Select|Wrap|Line Numbers
  1. strFilter = "[ID] =" & Me.cbxRegion
Mar 20 '15 #2
Seth Schrock
2,965 Expert 2GB
You need to add double quotes to break up your string. Right now it is all one big string.

Expand|Select|Wrap|Line Numbers
  1. strFilter = "[ID] ='" & Me.cbxRegion & "'"
***Edit***
Did see your second post. So cbxRegion must be a number and not text.
Mar 20 '15 #3
Brilstern
208 100+
Seth,

I tried that with no success. Using my above mentioned method it worked.
Mar 20 '15 #4
NeoPa
32,556 Expert Mod 16PB
Stevan.

Take your first line in the OP and, bearing in mind that the VBA side of things is using double-quote characters (") and the SQL is using single-quotes ('), go step-by-step and see what you expect to be passed from one to the other.

Remember, everything between the quotes (both types) is treated as string data which is not to be evaluated.

Separately, work out what you think each string should be. Now see where they differ. You'll see why by looking for where.

Once you have that understanding you should have the whole concept beaten and be able to handle all such situations in future with ease and a full understanding.
Mar 20 '15 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Chien Lau | last post by:
When using the MSDN library (July 2004 edition), I click the funnel icon to set the language filter to C#. For some reason, it's not retaining my selection. Each new page that I visit requires me...
2
by: Chien Lau | last post by:
When using the MSDN library (July 2004 edition), I click the funnel icon to set the language filter to C#. For some reason, it's not retaining my selection. Each new page that I visit requires me...
5
by: Paul de Goede | last post by:
I set the Response.Filter in my aspnet application but I have noticed that if you do a Server.Transfer that the filter doesn't get called. And in actual fact the response is mostly empty. It seems...
0
by: Vikram Sinha | last post by:
Hi, I am trying to apply a filter to button server control like this: <asp:button id="Button1" style="FILTER: DXImageTransform.Microsoft.BasicImage(rotation=3)" runat="server"...
3
by: chucher | last post by:
I'm trying to put a filter into some forms or filters but the filter donīt work properly. I'm using the format dd-mm-yyyy. The forms and the tables always shows how dates in that format. But...
0
by: =?Utf-8?B?SnVzdGluIFJvYmVydHM=?= | last post by:
Hi I am developing a mobile web VB asp.net application in VS 2005. The forms are mobile web forms. I have a mobile web configuration page (web.config). In one of my forms I have a DeviceSpecific...
5
by: HyBry | last post by:
I have a form with subforms on it. The main form is used for selecting an item and subform lists all it's properties in datasheet view. Problem is that when I right click in subforms contents and...
4
by: Sheree | last post by:
I have some Access 2003 VBA code that looks like this: Private Sub SubName() Me.FilterOn = True Me.Filter = "" ' Me.FilterOn = False ' Me.Requery x = msgbox("Filter Cleared. Number of...
18
by: Becker | last post by:
I have a combo box with a list a values that when picked the form should filter to show the corresponding record from a table. Everything works fine when I open up the form by itself. However, I...
17
Seth Schrock
by: Seth Schrock | last post by:
I'm attempting to filter a recordset. I had never done this before, so I looked to the MSDN website for help and found this website: Recordset.Filter Property. Here is the main excerpt from the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.