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

How do I get a recordset from a filtered form?

Access 2003

I need to have a user filter records on a linked, continuous form and
then I want to run various reports/queries from this recordset the user
created. I only need to see the PK values they filtered for.

On the form, there could be 10 controls displaying that the user
filters/sorts in whatever way they want to, but I only need to extract
the control holding the PK values as a "recordset" so that I can use
this to create a various amount of Reports/Queries from.

Can anyone please shed some light on how to do this?

Thanks in advance.

Apr 3 '06 #1
2 2339
"KashMarsh" <ka********@hotmail.com> wrote in
news:11**********************@j33g2000cwa.googlegr oups.com:
Access 2003

I need to have a user filter records on a linked, continuous
form and then I want to run various reports/queries from this
recordset the user created. I only need to see the PK values
they filtered for.

On the form, there could be 10 controls displaying that the
user filters/sorts in whatever way they want to, but I only
need to extract the control holding the PK values as a
"recordset" so that I can use this to create a various amount
of Reports/Queries from.

Can anyone please shed some light on how to do this?

Thanks in advance.


Grab the recordsetClone and loop through it, writing the pk to
a new table.

--
Bob Quintal

PA is y I've altered my email address.
Apr 4 '06 #2
KashMarsh wrote:
Access 2003

I need to have a user filter records on a linked, continuous form and
then I want to run various reports/queries from this recordset the user
created. I only need to see the PK values they filtered for.

On the form, there could be 10 controls displaying that the user
filters/sorts in whatever way they want to, but I only need to extract
the control holding the PK values as a "recordset" so that I can use
this to create a various amount of Reports/Queries from.

Can anyone please shed some light on how to do this?

Thanks in advance.

If all of the reports can use the same filter, create the report with no
filters in the recordsource. Then create the filter prior to calling
the report.

Method 1
For example, let's say you had a form with 10 controls used to filter.
First, create a Where clause. IE, cycle though the filter fields on the
form. Ex:
If Me.FirstName > "" Then strFilter = "[FirstName] = ""Joe"" And "
If Me.LastName > "" Then strFilter = "[LastName] = ""Blow"" And "
strFilter = Left(strFilter,Len(strFilter)-5 'get rid of And

Docmd.OpenReport "MyReport",,strFilter

This will open the report and filter it.

Method 2
You can also get the SQL statement of the report's recordsource and
break it out into parts; Select&From, Where, OrderBy

Build the Where filter string for the fields, a sort order string, and
create a SQL statement. Now make that SQL statement the Report's
recordsouce or a Query's SQL.
Apr 4 '06 #3

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

Similar topics

1
by: ano1optimist | last post by:
Has anyone had success with using a command collection with parameters to run a stored procedure from sql server? I'm frustrated and have been spending way too much time trying to make this work. ...
3
by: dbaxter7 | last post by:
OK, here's my dilemma. I am trying to create a system to track cases and clients. There are instances when cases have multiple clients, and there are instances where clients have multiple cases. ...
1
by: Ken | last post by:
I have a form that has a command button on it to open a report. The report is based on the forms data, if it's filtered the report is filtered, if the form is showing 100 records the report is...
1
by: Fretners | last post by:
I have a form that displays the contents of a table. I want to be able to apply filters though the form and then base an insert query on the filtered data to create a new row to match each row in...
2
by: atlbearcat | last post by:
Here's one that's been bugging me for about a week now... I have a form that allows users to filter records, simple enough. But I want to give them the option to export the filtered records to...
3
by: Thelma Roslyn Lubkin | last post by:
I have a form whose rowsource is a single table, i.e. 'Datasystem'. I use a combobox to search for records in that table based on the value of a single field, i.e., 'systemname'. I use a...
0
by: ramseyscripts | last post by:
I have Table A that is displayed through a form. Table A can be filtered through the form to create a subset of Table A records. How can I create a new table, Table B, with only the records in the...
6
by: jnahman | last post by:
Hi I have a database into which multiple users input data. They are fearful of overwriting each others data. I would like to create a log on form in which each user inputs their employee ID. I would...
3
by: Neil Chinneck | last post by:
Hi everyone, I'm looking for some help please. I have a continuous form, with several fields which can be filtered using combo boxes. Once the user has filtered the form, I want them to enter...
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:
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...
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.