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

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.Depending 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.afid) = " & 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 1310
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.Depending 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.afid) = " & 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.google.co m:
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.Depending 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.afid) = " & 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.OpenReport 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
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...
0
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...
4
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...
4
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...
4
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...
2
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...
3
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...
3
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...
2
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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
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...

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.