473,748 Members | 7,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Remove the results from the previous command

I need some help in finding a way to remove the filter from the
previous command.
I open the report from a form where i have option group called
Office.Dependin g on the option
in the option group,the record source in the report is filtered for
this option.
In the OnOpen event of the report i have :

Public town As Long
town = Forms![Form1]![Office]
In the Where part of the record source ,called Bas,( Me.RecordSource =
Bas) i have :
And ((customers.afi d) = " & town & "

My code works, but only if i try again.For example,if i press the
office Number 1, then i get null.
If i press the button second time, then i get the results.If i want
then to find the results for the office Number 2, then i get the
results for the office Number 1.I have to press the button 2 seond
time, to get the right results.
Obviously i need to remofe the results in the report from the previous
command.
I tried to write the following in the OnClose event of the report :
town = ""

I got the message type mismatch

Is it possible to get the results in my report from the first time ?
Nov 13 '05 #1
2 1355
Johm wrote:
I need some help in finding a way to remove the filter from the
previous command.
I open the report from a form where i have option group called
Office.Dependin g on the option
in the option group,the record source in the report is filtered for
this option.
In the OnOpen event of the report i have :

Public town As Long
town = Forms![Form1]![Office]
In the Where part of the record source ,called Bas,( Me.RecordSource =
Bas) i have :
And ((customers.afi d) = " & town & "

My code works, but only if i try again.For example,if i press the
office Number 1, then i get null.
If i press the button second time, then i get the results.If i want
then to find the results for the office Number 2, then i get the
results for the office Number 1.I have to press the button 2 seond
time, to get the right results.
Obviously i need to remofe the results in the report from the previous
command.
I tried to write the following in the OnClose event of the report :
town = ""

I got the message type mismatch

Is it possible to get the results in my report from the first time ?


Can't you prompt the user for the town on the form and then pass that in
the Where string of the report.

Ex:
strTown = "Los Angelese"
Docmd.OpenForm "ABC",,,"[town]= '" & strTown & "' And Office = " & Me.Office

Nov 13 '05 #2
ke**@abv.bg (Johm) wrote in
news:24******** *************** **@posting.goog le.com:
I need some help in finding a way to remove the filter from
the previous command.
I open the report from a form where i have option group called
Office.Dependin g on the option
in the option group,the record source in the report is
filtered for this option.
In the OnOpen event of the report i have :

Public town As Long
town = Forms![Form1]![Office]
In the Where part of the record source ,called Bas,(
Me.RecordSource = Bas) i have :
And ((customers.afi d) = " & town & "

My code works, but only if i try again.For example,if i press
the office Number 1, then i get null.
If i press the button second time, then i get the results.If i
want then to find the results for the office Number 2, then i
get the results for the office Number 1.I have to press the
button 2 seond time, to get the right results.
Obviously i need to remofe the results in the report from the
previous command.
I tried to write the following in the OnClose event of the
report : town = ""

I got the message type mismatch

Is it possible to get the results in my report from the first
time ?

I don't know why you are going to open the report from the form
using code in the report instead of simply creating the where
clause in the form and passing it to the report as part of the
openreport method of docmd.

DoCmd.OpenRepor t reportname[,view][,filtername][,wherecondition]
--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2330
by: Mike Nau | last post by:
I'm using command center to view my data. When I enter a query on the interactive tab, once executed it takes me to the results tab but doesn't display anything. If I enter the same query in the CLP, everything works fine. For some reason, my results tab seems to not be working properly. Any idea? I'm running version 8.1.4.
0
2680
by: Mark Payne | last post by:
Gudday, I have an Access 2000 database which I am using as a phone directory of residents in the hostel where I work. The front end for this directory is a form with a text box (the search name etc) and two combo boxes that let you choose options relating to the search name. These three controls are referenced by a query, the results of which are the control source for a subform on the main form. so far, so good.
4
3347
by: Anders Borum | last post by:
Hello! I'm am currently working on making a central cache component threadsafe, and was looking at the synchronized implementation of the Hashtable. I was wondering why you'd really want to enforce thread safety in a remove method? Why would you care if two threads are trying to remove the same key from the hashtable? In the end, the key is removed (and that was probably what you were looking for).
4
5034
by: Haydnw | last post by:
Hi, I'd like to put a load of database results (several rows for 5 fields) into a two-dimensional array. Now, this may be a really stupid question, but can someone give me a pointer for how to do it? I can bind data to datagrids and lists and stuff all day long, but can't seem to grasp this one. Any pointers to a useful article / demo (or just any useful pointers!) would be much appreciated. Thanks,
4
7930
by: Nathan | last post by:
I want to delete a row from a dataset, and I use: Dim SelectedRow() as DataRow = DataSet1.Table1.Select("Selection Criteria") DataSet1.Table1.Rows.Remove(SelectedRow(0)) The SelectedRow returns 1 row = SelectedRow(0). This successfully removes the row from the dataset, but upon calling the update command (DataAdapter1.Update(DataSet1, "Table1") the database is not updated. When I refresh the dataset, the removed row is still there. ...
2
2443
by: Daniel Di Vita | last post by:
I have created an ASP.NET page that allows the user to page through a result set. I need to expand on this. On that same page I a filed where the user can type in a search string. When they click a button ALL the results will be returned and the closest match to the search string will be highlighted. The approach I am taking to page the data is to put the keys/indexes into an array then create another data reader based on those results to...
3
2098
by: Mark A | last post by:
In the DB2 Admin Client (8.2.4), when the results of a query are displayed in the grid that looks like a spreadsheet (using Command Editor or double click on table name in Control Center). The data in this grid is updatable. When a cursor is first placed on one of the columns, no update takes place. When the cursor is then merely moved to another row (any column) the previous row is updated, even if it was not changed. If the user does...
3
6439
by: Beholder | last post by:
I hope that someone can help me with the following: Short background explenation: I have a shrfepoint page (newform.aspx) in a item list. On this page is a lookup column that displays a lookup of all category items in previous items. In the code this results in a select/options list like this: <SELECT TABINDEX=1 NAME="urn:schemas-microsoft-com:office:office#CatLookup"><OPTION
2
9093
by: =?Utf-8?B?R3JlZw==?= | last post by:
I have the following code the dynamically adds a specific number of controls. for x as integer = 1 to 10 Dim btn as Windows.Forms.Button = New Windows.Forms.Button btn.Name = "btn" & x btn.Text = "Test" & x controls.add(btn) next x This results in 10 buttons appearing on the screen. I've excluded the
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8242
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.