473,783 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to filter records in an append query by choosing field in a form

121 New Member
I have a function that copies records from a table called ETL to a table called EXPORT then it exports the records in EXPORT as an excel.

The record are all marked as coming from a set of data owners.

What I'm trying to do now, is to filter the records that get copied into the EXPORT table by having the users choose which "DATA_OWNER " they want to export the records for. I would like to have them choose on a form which data owner they want and then have a button on the form which then copies the records to the export table (filtered by the selected data owner) and then exports the spreadsheet.

I can get through the whole process, except for how to get the users to select the field and thenuse that to filter the records taht get copied.

Any help would be greatly appreciated.
Apr 10 '07 #1
4 4310
pks00
280 Recognized Expert Contributor
What is the code you have now that copies from ETL to EXPORT
Is it just a append query?

If so then u could add filters to that
by doing the copying via code
or creating a temp query and using that

but I need to know what u currently do to perform the copy from ETL to EXPORT
Apr 12 '07 #2
nico5038
3,080 Recognized Expert Specialist
You can create an unbound form (not linked to a table) with a combobox showing the distinct DATA_OWNER's. Name this form frmSelectDataOw ner and the combobox cmbDataOwner.

Just use as source for the combobox:
select distinct DATA_OWNER from EXPORT

Next create a query named "qryDataOwn er" referring to the combobox on the form as a criteria for the DATA_OWNER like:
forms!frmSelect DataOwner!cmbDa taOwner
This query will only work when the form is active and a DataOwner has been chosen.

Now add a button to trigger the export to excel with the command:
docmd.transfers preadsheet acExport, "qryDataOwner", ....

In the additional parameters the excel version and the target file are set.
When creating the filename just add the combobox value to get an excel sheet "named" like:
"C:\Datashe et_" & me.cmbDataOwner & ".xls"

Getting the idea ?

Nic;o)
Apr 13 '07 #3
JHNielson
121 New Member
What is the code you have now that copies from ETL to EXPORT
Is it just a append query?

If so then u could add filters to that
by doing the copying via code
or creating a temp query and using that

but I need to know what u currently do to perform the copy from ETL to EXPORT

The code is just a simple append query - the two tables are nearly identical
Apr 14 '07 #4
NeoPa
32,577 Recognized Expert Moderator MVP
I have a function that copies records from a table called ETL to a table called EXPORT then it exports the records in EXPORT as an excel.

The record are all marked as coming from a set of data owners.

What I'm trying to do now, is to filter the records that get copied into the EXPORT table by having the users choose which "DATA_OWNER " they want to export the records for. I would like to have them choose on a form which data owner they want and then have a button on the form which then copies the records to the export table (filtered by the selected data owner) and then exports the spreadsheet.

I can get through the whole process, except for how to get the users to select the field and thenuse that to filter the records taht get copied.

Any help would be greatly appreciated.
In the code behind a button on your form...
  1. Get the SQL out of your current APPEND query.
  2. Update your SQL to include a WHERE clause designed to select the item(s) from your Owners list (ComboBox or Multi-Select ListBox depending on requirements).
  3. Execute the new updated SQL (DoCmd.RunSQL ...).
  4. Execute the TransferSpreads heet command as before.
Apr 17 '07 #5

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

Similar topics

6
2506
by: Robin S. | last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope I've done a better job of explaining myself below. I am trying to produce a form to add products to a table (new products). Tables: tblCategoryDetails CategoryID SpecID
6
4629
by: Ralph2 | last post by:
Some time ago with a lot of help from this group I made a reasonably successful database to keep track of our shop drawings. However the searching mechanism is too complicated for the occasional user and I would like to change the whole process. I would like to duplicate the layout of my form... but each field becomes a simple "searching" ListBox. On completing any one search field all the rest are filtered to this value. Subsequent...
3
4047
by: google | last post by:
This is something I've done plenty of times in '97, but I can't seem to get it to work correctly in Access 2003. Say, for example, I have a form with an unbound combobox, the data source is a table of customers, first column is the key field, which is hidden with a 0" width, and the second column is the customer name. The SQL is a union query that also inserts Null in the first column, and "All" in the second column. That combobox gets...
11
6112
by: Bob | last post by:
I am in the process of upgrading an Access database to SQL Server (and climbing that learning curve!). The wizard happily upgraded all the tables and I can link to them OK using ODBC. The application controls allocation of revisions to aircraft maintenance manuals for an airline type operation. In the application there is a form loaded at start-up allowing the user/s to select the records that they are currently interested in from 4...
5
2657
by: Ron S | last post by:
After days of searching I finally an example that would work with my application, the only problem is after entering all of the code it is not working. Would someone be kind enough to take a look at this... Exmaple web site: http://allenbrowne.com/ser-62.html My Code: 'Purpose: This module illustrates how to create a search form, _ where the user can enter as many or few criteria as they wish, _ and results...
2
5545
by: jcf378 | last post by:
hi all. I have a form which contains a calculated control ("days") that outputs the # of days between two dates (DateDiff command between the fields and ). However, when I click "Filter by Form" in order to search for records based on this form, I would like to be able to enter a value in this "days" control so that I can filter records on the form based on this calculated interval (i.e., i want to search for records specifically where...
2
1469
by: Gareith Stanley | last post by:
Hi again :) I have a form that user enters parameters into which then pops up another form with results filtered by the chosen parameter (field in table) What I'd like to do is order the results from the query it fires by a record set of my choosing. I think I'm on the right track by trying to edit the sql that is passed to the query but it doesn't seem to work..... Example from form that runs the query filtering by 'section/faculty'...
11
3680
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night) and the 'employee name'. There is another table which assigns an ID to the Shifts, i.e. 1,2 and 3 for morn, eve & night shifts respectively. From the mother table, the incentive is calculated datewise for each employee as per his shift duty. In...
1
2849
by: Barb.Richards | last post by:
I have created an append query that pulls information from one database, and will append the selected information into a new table. The fields are setup like 'number' 'category' 'code' 'shares' and 'dollars'. Using the "backend" of this table I can filter the numbers by right clicking and using Filter For: then enter 1 or 2 or 3 and this will return results for all information that has 1 or 2 or 3 as a number. However, the problem I...
0
9643
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...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10081
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
9946
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
8968
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
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
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

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.