Use a Qry as a filter in a form

D

daisy

First I want to tell everyone thank you for all of your help on these boards.
It is a life saver. Someone mentioned in an earlier post that I could create
a query to use as a filter in a form? I'm not sure how to do this? Here's
what's happening:

There is a data table that has new monthly data
appended to it. The newly appended data could have history associated with it

for example
EffQtr Event CustomerID CustomerName InvoicedAmt
2008-1 New 123456 Customer A $25
2009-1 Renewal 123456 Customer A $50
New Data that gets appended
EffQtr Event CustomerID CustomerName InvoicedAmt
2010-1 123456 Customer A $25

I would like to create a form that would have a filter to choose the
Customers that have newly appended data and any of their historical data yo
update the event and a few other fields. We have to be able to see the
historical at the same time to be able to update the fields.
 
J

John W. Vinson

First I want to tell everyone thank you for all of your help on these boards.
It is a life saver. Someone mentioned in an earlier post that I could create
a query to use as a filter in a form? I'm not sure how to do this? Here's
what's happening:

There is a data table that has new monthly data
appended to it. The newly appended data could have history associated with it

for example
EffQtr Event CustomerID CustomerName InvoicedAmt
2008-1 New 123456 Customer A $25
2009-1 Renewal 123456 Customer A $50
New Data that gets appended
EffQtr Event CustomerID CustomerName InvoicedAmt
2010-1 123456 Customer A $25

I would like to create a form that would have a filter to choose the
Customers that have newly appended data and any of their historical data yo
update the event and a few other fields. We have to be able to see the
historical at the same time to be able to update the fields.

It's not so much using a "query as a filter" as "basing the form on a query".
Are these two different tables? or are you importing directly into the table?
What exactly do you want to do: append the new record? Alter existing records?
Allow the user to see the old and the new data in conjunction so they can
manually edit it? or what?
 
D

daisy

I'd like to append the data into one data table and then be able to make
edits based on all of the data associated with that particular customer. So I
need the query to be able to pull history data with the new data but only for
those customers coming in that month
 
J

John W. Vinson

I'd like to append the data into one data table and then be able to make
edits based on all of the data associated with that particular customer. So I
need the query to be able to pull history data with the new data but only for
those customers coming in that month

Then you'll need to record somewhere in the table when the customers "come". I
don't see anything in your data that would distinguish new records from old
ones, and Access certainly doesn't keep track.

You could include a DateAdded field, default value Date() (or if you want to
record the exact time, Now()), and run an Append query appending to the other
fields from your external source.

You could then use this field with a criterion of
= DateSerial(Year(Date()), Month(Date()), 1)

to find all data added this month; you could even have a form based on this
query, with a subform (linked on customerID) based on a query selecting data
older than that.
 
D

daisy

thank you how would the form pull in data associated with it that is older
than the current data?
 
J

John W. Vinson

thank you how would the form pull in data associated with it that is older
than the current data?

By using appropriate criteria. Since I know nothing about your "current data",
nor the structure of your table, nor exactly what you're looking for it's a
bit hard to give a specific answer! For data with a datefield prior to today's
date, you can use

< Date()

on the criteria line.
 
D

daisy

Hi John, Maybe this will help. I'm not sure how to build this form with
criteria before the month I've just added?

Here's my table structure
EffQtr
EffYear
OrigDt
Region
CustomerID
CustomerName
DealStDt
DealEndDt
Event
InvoiceAmt
ListAmt
LocalAmt
AnnualFees
AddedDt
 
J

John W. Vinson

Hi John, Maybe this will help. I'm not sure how to build this form with
criteria before the month I've just added?

Here's my table structure
EffQtr
EffYear
OrigDt
Region
CustomerID
CustomerName
DealStDt
DealEndDt
Event
InvoiceAmt
ListAmt
LocalAmt
AnnualFees
AddedDt

Looks like you have a lot of date or date-related fields: EffQtr, EffYr,
OrigDt, DealStDt, DealEndDt, AddedDt. Which of these do you want to use as a
criterion - AddedDt? And what do you mean by "build the form with criteria
before the month"???? Example please!
 
D

daisy

Hi John, thank you for responding. I would like to create a filter for new
records coming in based on AddedDt

and then I would like to somehow link all data associated with the
CustomerID & CustomerName to pull thru as well?

Example: AddedDt = 2010-03
EffQtr CustomerID CustomerName Event InvoiceAmt
AnnualFees
2010-2 124 Customer A Renewal 2 $1200
$1200


Historical data
Example: AddedDt = 2010-03
EffQtr CustomerID CustomerName Event InvoiceAmt
AnnualFees
2008-1 124 Customer A New $1200
$1200
2009-1 124 Customer A Renewal $xxx
$xxxx
 
J

John W. Vinson

Hi John, thank you for responding. I would like to create a filter for new
records coming in based on AddedDt

Put a criterion on AddedDt of

< DateSerial(Year(Date()), Month(Date()), 1)

and it will pull all records with an AddedDt prior to the first day of the
current month.
and then I would like to somehow link all data associated with the
CustomerID & CustomerName to pull thru as well?

Create a Query. Add this table (whatever it is) and the customer table, joined
by CustomerID. Pull the Event, EffQtr, InvoiceAmt and so on from this table,
and the CustomerName and any other desired fields from the Customer table.

Get to know queries. They are *absolutely basic* to any constructive use of
Access, and they're the very basis of relational database design!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top