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
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)
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.
You must: - Explicitly Save the newly added Record in the AddCustomers Form.
- Define the Filter based on the newly added Company Name.
- These steps must be taken before the Form is closed and the Focus shifts back to the Filter Form.
- The General idea, in its simplest form, would be:
- Dim stOpenArgs As String
-
-
stOpenArgs = Me.CompanyName.Value
-
-
Me.Dirty = False 'Explicit Save Record
-
-
With Forms!CustomersFinder
-
!txtFindAsUTypeValue.SetFocus
-
!txtFindAsUTypeValue.Value = stOpenArgs
-
.Filter = "[CompanyName] = '" & stOpenArgs & "'"
-
.FilterOn = True
-
!txtFindAsUTypeValue.Requery
-
End With
-
-
DoCmd.Close
NeoPa 32,556
Expert Mod 16PB
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"!
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: - .Filter = "[<FilterField>] = " & CLng(stOpenArgs)
P.S. - If this approach does not work, show the actual Code you are using.
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.
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.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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...
|
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...
|
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...
|
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)...
|
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...
|
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
| |