473,326 Members | 2,337 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,326 software developers and data experts.

Why is the filter not working?

Hi All,

First of all A Happy New Year to one and all.

I downloaded this small sample database from Allenbrowne’s site at the following page http://allenbrowne.com/AppFindAsUType.html .

I have modified it to suit my working database. I have added a new form to the sample. When a company name is searched and not found, it can be added using “Add New Customer”.

What I am trying to do is when I close the “Add New Customer” form, I am using the company name to be pasted in the “txtFindAsUTypeValue” text box, but it is not filtering and showing the record.

What am I doing wrong? Thanks to all in advance
Attached Files
File Type: zip FindAsUType2000.zip (70.4 KB, 127 views)
Jan 31 '13 #1
8 13148
zmbd
5,501 Expert Mod 4TB
Are you sure that you had the form in question requery after adding the new record?

(sorry, I don't have time to download and disect your database)
Jan 31 '13 #2
Rabbit
12,516 Expert Mod 8TB
As a rule of thumb, and for security purposes, I do not download files from stranger. Please post all relevant info and code in the thread itself.
Jan 31 '13 #3
ADezii
8,834 Expert 8TB
You must:
  1. Explicitly Save the newly added Record in the AddCustomers Form.
  2. Define the Filter based on the newly added Company Name.
  3. These steps must be taken before the Form is closed and the Focus shifts back to the Filter Form.
  4. The General idea, in its simplest form, would be:
    Expand|Select|Wrap|Line Numbers
    1. Dim stOpenArgs As String
    2.  
    3. stOpenArgs = Me.CompanyName.Value
    4.  
    5. Me.Dirty = False    'Explicit Save Record
    6.  
    7. With Forms!CustomersFinder
    8.   !txtFindAsUTypeValue.SetFocus
    9.   !txtFindAsUTypeValue.Value = stOpenArgs
    10.   .Filter = "[CompanyName] = '" & stOpenArgs & "'"
    11.   .FilterOn = True
    12.   !txtFindAsUTypeValue.Requery
    13. End With
    14.  
    15. DoCmd.Close
Jan 31 '13 #4
NeoPa
32,556 Expert Mod 16PB
Please check out these links before posting any new questions :
How to ask "good" questions -- READ BEFORE SUBMITTING A QUESTION!.
Before Posting (VBA or SQL) Code.
Jan 31 '13 #5
Adezii, thanks for the answer. It is working very well with the sample database that I downloaded. when I tried to integrate it into my database, I was getting an error message "Data mismatch in criteria expression"!
Feb 1 '13 #6
ADezii
8,834 Expert 8TB
If the Field that you are filtering on is Numeric (let's assume a LONG INTEGER), then the Line of Code assigning the Filter would be:
Expand|Select|Wrap|Line Numbers
  1. .Filter = "[<FilterField>] = " & CLng(stOpenArgs)
P.S. - If this approach does not work, show the actual Code you are using.
Feb 1 '13 #7
zmbd
5,501 Expert Mod 4TB
I was getting an error message "Data mismatch in criteria expression"!
Sorry,
Why didn't you provide that information to begin with?

Have you done as noted within the first section with the compile: Before Posting (VBA or SQL) Code as asked by Neopa?

You might want to tell us ANYTHING else you forgot to mention? Maybe you'd like to tell us all of the modifications you've made to the basic design and any other errors.
Feb 1 '13 #8
ADezii,

Thanks for your suggestion. Working well now.

I have another problem. Once the form "Add New Customer" is clicked and the user tries to close the form without adding a new customer, a warning "invalid use of null" pops up and the user can not close the form.

How do I get around this.
Feb 2 '13 #9

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

Similar topics

5
by: BlackFireNova | last post by:
I need to write a report in which one part shows a count of how many total records fall within the working days (Monday - Friday) inside of a (prompted) given date range, in a particular...
3
by: Richard | last post by:
Hi, I have a form based on a table. When I filter the form I want to run a report based on the same table with the same filter as the form. No problem until I want to filter a combo box where...
4
by: Nhmiller | last post by:
This is directly from Access' Help: "About designing a query When you open a query in Design view, or open a form, report, or datasheet and show the Advanced Filter/Sort window (Advanced...
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...
2
by: Anandan | last post by:
Hi, In our Project we use Dataset to load the Grid with Values. We have some criteria to filter the values to be shown in the Grid. For that we used the SELECT command to filter the Same...
9
GazMathias
by: GazMathias | last post by:
Hi Guys, Acc2003. I have a form that is misbehaving by suddenly refusing to apply a filter I am passing to it. In a nutshell, I use a public variable to control the form's behaviour called...
4
by: kcropper | last post by:
Hi, I’ve been trolling these forums for a while now, and while I’ve found other related threads (e.g., http://bytes.com/topic/access/answers/702416-search-code-how-filter-using-code-sql), nothing has...
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...
0
by: Pietro Malerba | last post by:
Hello! I'm testing quicksand script (http://razorjack.net/quicksand/) to filter some image. I had implemented the script with some image (http://www.hostingcubo.com/quicktest.php) 
As you can see...
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.