473,387 Members | 1,897 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,387 software developers and data experts.

Filter a record on a continuous form

547 512MB
I have an unbound txtbox at the top of a continuous form, to filter records below that could be in any of two fields - "ICN" or MICN"
If i add the item code to the txtbox , then it must look at both. I use the "onchange event"
Expand|Select|Wrap|Line Numbers
  1. Me.Refresh
  2.     ''strFilter = "icn like '*" & Me.findCode & "*'"  ' this works 100% for 1 field only
  3.  strFilter = "icn like '*" & Me.findCode & "*'" Or "micn like '*" & Me.findCode & "*'"
  4.  
  5.     Me.Form.Filter = strFilter
  6.     Me.Form.FilterOn = True
  7.     Me.findCode.SelStart = Nz(Len(Me.findCode), 0)
It has to do with the "strfilter" row. Please assist.
Aug 14 '13 #1
4 1172
zmbd
5,501 Expert Mod 4TB
Neelsfar,
You've really provided very little information to work with, such as Access version, the data types, EXACT error message (title, number, and text) you are (or if you are not) receiving. The desired results and what is actually happening.

However, as a stab in the dark please try two things:
Please do the following:
Read thru the following link: set the option explicit and do the basic trouble shooting and compile as given in the first few parts.

While you are doing this, also insert right after line3 in the code block:
Expand|Select|Wrap|Line Numbers
  1. debug.print "Your criteria = " & strFilter
Run your code, press <Ctrl><G> to open the immediate window. You will see the result of your string in this the window. Review it for correct format. Copy and paste it back here if you don't see the issue

> Troubleshooting and posting (VBA or SQL) Code
Aug 14 '13 #2
Seth Schrock
2,965 Expert 2GB
The problem (at least one of them) is that the "OR" isn't included in the double quotes so it isn't being part of the string.

Expand|Select|Wrap|Line Numbers
  1.  strFilter = "icn like '*" & Me.findCode & "*' Or micn like '*" & Me.findCode & "*'"
You would have certainly discovered this using Z's instructions. Please still follow them to make sure that the string does in fact concatenate like you expect.
Aug 14 '13 #3
zmbd
5,501 Expert Mod 4TB
One of the issues; however, having the resolved string from the debug print will help to point out any others.
Aug 14 '13 #4
neelsfer
547 512MB
Thx zmbd for suggestion i was away the whole day and got back now only.Will do it next time. Zeth you are spot on - 1 works! thx
Aug 14 '13 #5

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

Similar topics

3
by: David | last post by:
Hi, I need a button shown for each record (cont. form) with specific captions on each. I have a notes form for each record. When a user presses the button they can read the notes. I want to...
4
by: Kathy | last post by:
What is the standard technique for handling the fields in the following scenario on a continuous form? Multiple Divisions. Each Division has multiple Buildings. Each Building has a Supervisor. ...
3
by: Stewart | last post by:
Hi all! My (relatively small) database holds data on staff members and the projects (services) that they are assigned to. In my form frmStaff, I have a list of staff members - it is a...
2
by: bobh | last post by:
Hi All, In Access97 I have a form setup as a continuous form several of the bound controls have calculations that are done in the 'after update' event via VBA code and all works fine. My...
3
by: ApexData | last post by:
I am using a continuous form for display purposes. Above this form, a single record is displayed so that when the user presses my NewButton they can enter a NewRecord which gets added to the...
3
by: eighthman11 | last post by:
Using Access 2000. I have a continuous form which for simplicity sack has two fields Social Security Number and Last Name. In the header of the continuous form I have a textbox where you can...
13
by: eighthman11 | last post by:
using Access 2003 and sql server version 8.0 Hey everyone. Created a text box where the user types in an Inventory number and it takes them to that inventory number on the contimuous form. The...
4
by: Jollywg | last post by:
I have a continuous form that i need to filter by the contents of a textbox. The text box name is txtInvoiceNumber. This is what i have and it does not work....and its driving me crazy!! ...
4
by: Adam Tippelt | last post by:
Situation: I'm using a continuous form to display a lot of information stored in a datasheet. I'm using the form because it allows me to display multiple rows of information per 'record' which is...
2
by: Ian Anderson | last post by:
Hello there, SO i have the followign VB code in my continuous form... 'Purpose: This module illustrates how to create a search form, _ where the user can enter as many or few...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.