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

Calulated field to do Reviews?

I have a Main Table with client demographics and a Detail Table with
Action History

The Action History has the following fields

Action Field= Initial, Recert, Change
Action Date Field= Date the Action occurred
Status Field=Active, Denied, Terminated
Status Date Field=Date the Status was changed

I now need to set up a Review Date (Calculated Field) 6 months from the
Last Status Date where there was a Initial, or Recert Action completed
and then pull up a report.

I understand I need to do a Query, but how do I get it to calculate
from the Last Status Date when there could be a many previous Initial
or Recert Dates. I understand how to set up a calculated field from a
text box. It is the formula I need.

Is there a way to do this? Thanks for any help..........

Nov 13 '05 #1
8 1134
Query 2:
SELECT qryIntermediateNeedFollowup.AccountID,
Max(qryIntermediateNeedFollowup.ActionDate) AS MaxOfActionDate,
DateAdd("m",6,[qryIntermediateNeedFollowup]![ActionDate]) AS NextDate
FROM qryIntermediateNeedFollowup
GROUP BY qryIntermediateNeedFollowup.AccountID,
DateAdd("m",6,[qryIntermediateNeedFollowup]![ActionDate]);

Query1 (qryIntermediateNeedFollowup):
SELECT tblActionHistory.AccountID, tblActionHistory.ActionDate,
[Action] In ("Initial","Recert") AS NeedsFollowup
FROM tblActionHistory
WHERE (((tblActionHistory.Action) In ("Initial","Recert")));
The first query just puts all the Initial/Recert records together so
that I can grab the latest value. Then the second query does it.
Maybe you can do this with one query, but you can play with that part.
Hope this gets you started.
Pieter

Nov 13 '05 #2
Pieter

Can you translate this to a newbie that doesn't know code?
I can do a query that will select the Initial/Recert and can set it up
to pull up the data between certain dates, but get lost after
that.........

Nov 13 '05 #3
Randy,
Maybe, but translating a set of mouse movements and such in the Query By
Example Grid--you know this as a query window--is cumbersome. Behind the
scenes Access is translating your mouse movements & so on into SQL. What
Piet wrote for you is the end result. A lot of us have become accustomed to
typing SQL without the help of the QBE grid. I am willing to talk you
through the basics of SQL if you respond here.

--
Alan Webb
kn*******@SPAMhotmail.com
"It's not IT, it's IS"
"Randy" <ra****@msn.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
Pieter

Can you translate this to a newbie that doesn't know code?
I can do a query that will select the Initial/Recert and can set it up
to pull up the data between certain dates, but get lost after
that.........

Nov 13 '05 #4
Randy,
create a new query. Don't put any tables in it. Then hit the SQL
button on the top left. (I think it's a pulldown - I'm not looking at
it). One option should be SQL. Select that. Then copy the SQL
statement above for Query1 and name it as I did. Then save it. Then
do the same for the second query. Does this get you where you need to
go?
There's no code here.... none whatsoever. It's all pure SQL

Nov 13 '05 #5
Randy,
Sorry, I am going to follow Piet Linden's lead and try again. From your
message, it sounds like we just want to look for the last thing that
happened with a client. I'll have to make some guesses about your tables,
so forgive me if what I write won't work without changes. So, an example
select statement might look like:

"SELECT LAST_STATUS_VW.CLIENT_NAME,
DATEADD("M",6,LAST_STATUS_VW.LAST_STATUS_DATE) AS NEXT_REVIEW_DATE FROM
(SELECT TOP 1 CLIENT_TBL.FULL_NAME AS CLIENT_NAME,
ACTION_HISTORY_TBL.STATUS_DATE AS LAST_STATUS_DATE FROM CLIENT_TBL INNER
JOIN ACTION_HISTORY_TBL ON CLIENT_TBL.ID = ACTION_HISTORY_TBL.CLIENT_ID
ORDER BY STATUS_DATE DESC) AS LAST_STATUS_VW;"

This is perhaps a bit simpler than Piet's attempt. Both of us are guessing
a bit because we only have a limited knowledge of the database from which
the data is derived. SQL is actually an attempt at simplifying the task of
requesting data from a database compared to what came before it. Basic
SELECT statements are fairly straightforward. I'd encourage you to invest
in a SQL for Dummies book or some such. You get better results from the
database, you are worth more money, and wealth is sexier.
--
Alan Webb
kn*******@SPAMhotmail.com
"It's not IT, it's IS
"Randy" <ra****@msn.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I have a Main Table with client demographics and a Detail Table with
Action History

The Action History has the following fields

Action Field= Initial, Recert, Change
Action Date Field= Date the Action occurred
Status Field=Active, Denied, Terminated
Status Date Field=Date the Status was changed

I now need to set up a Review Date (Calculated Field) 6 months from the
Last Status Date where there was a Initial, or Recert Action completed
and then pull up a report.

I understand I need to do a Query, but how do I get it to calculate
from the Last Status Date when there could be a many previous Initial
or Recert Dates. I understand how to set up a calculated field from a
text box. It is the formula I need.

Is there a way to do this? Thanks for any help..........

Nov 13 '05 #6
pi********@hotmail.com wrote:
<removed Query2>
: Query1 (qryIntermediateNeedFollowup):
: SELECT tblActionHistory.AccountID, tblActionHistory.ActionDate,
: [Action] In ("Initial","Recert") AS NeedsFollowup
: FROM tblActionHistory
: WHERE (((tblActionHistory.Action) In ("Initial","Recert")));
: The first query just puts all the Initial/Recert records together so
: that I can grab the latest value. Then the second query does it.
: Maybe you can do this with one query, but you can play with that part.
: Hope this gets you started.

I too am new to this environment. You [pietlinden] make a second
post in which you say that these are simply SQL statements, not
code at all. Does this mean that I cannot put a SQL statement
like Query1 above into a piece of code, e.g. a subroutine that
handles an event like click? I see this select as defining an
array NeedsFollowup and I was hoping that I could just put such
'code' into a subroutine and use it for further processing.
--thelma

: Pieter

Nov 13 '05 #7
Randy,
Belay that, the SELECT TOP 1 will only get you the last client that had
activitiy. Ok, never mind, then.
--
Alan Webb
kn*******@SPAMhotmail.com
"It's not IT, it's IS"

"Alan Webb" <kn*******@hotSPAMmail.com> wrote in message
news:dY********************@comcast.com...
Randy,
Sorry, I am going to follow Piet Linden's lead and try again. From your
message, it sounds like we just want to look for the last thing that
happened with a client. I'll have to make some guesses about your tables,
so forgive me if what I write won't work without changes. So, an example
select statement might look like:

"SELECT LAST_STATUS_VW.CLIENT_NAME,
DATEADD("M",6,LAST_STATUS_VW.LAST_STATUS_DATE) AS NEXT_REVIEW_DATE FROM
(SELECT TOP 1 CLIENT_TBL.FULL_NAME AS CLIENT_NAME,
ACTION_HISTORY_TBL.STATUS_DATE AS LAST_STATUS_DATE FROM CLIENT_TBL INNER
JOIN ACTION_HISTORY_TBL ON CLIENT_TBL.ID = ACTION_HISTORY_TBL.CLIENT_ID
ORDER BY STATUS_DATE DESC) AS LAST_STATUS_VW;"

This is perhaps a bit simpler than Piet's attempt. Both of us are
guessing a bit because we only have a limited knowledge of the database
from which the data is derived. SQL is actually an attempt at simplifying
the task of requesting data from a database compared to what came before
it. Basic SELECT statements are fairly straightforward. I'd encourage
you to invest in a SQL for Dummies book or some such. You get better
results from the database, you are worth more money, and wealth is sexier.
--
Alan Webb
kn*******@SPAMhotmail.com
"It's not IT, it's IS
"Randy" <ra****@msn.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I have a Main Table with client demographics and a Detail Table with
Action History

The Action History has the following fields

Action Field= Initial, Recert, Change
Action Date Field= Date the Action occurred
Status Field=Active, Denied, Terminated
Status Date Field=Date the Status was changed

I now need to set up a Review Date (Calculated Field) 6 months from the
Last Status Date where there was a Initial, or Recert Action completed
and then pull up a report.

I understand I need to do a Query, but how do I get it to calculate
from the Last Status Date when there could be a many previous Initial
or Recert Dates. I understand how to set up a calculated field from a
text box. It is the formula I need.

Is there a way to do this? Thanks for any help..........


Nov 13 '05 #8
Thelma,
SQL can be run from code. I do it all the time. It isn't as simple as
pasting the text of the SQL statement into a function in the VB editor
window, but it isn't hugely difficult either.

--
Alan Webb
kn*******@SPAMhotmail.com
"It's not IT, it's IS
"Thelma Lubkin" <th****@alpha2.csd.uwm.edu> wrote in message
news:d6**********@uwm.edu...
pi********@hotmail.com wrote:

Does this mean that I cannot put a SQL statement like Query1 above into a
piece of code,
e.g. a subroutine that handles an event like click?

Nov 13 '05 #9

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

Similar topics

2
by: WQ | last post by:
Folks, Perhaps, this is a very commonly asked question. Pardon me for not being attentive before. Is there a website/resource where I can get some reviews on Dot Net 3rd party components. ...
7
by: Tim Chmielewski | last post by:
The following page is a test for a form that is meant to accept extra order information for certain products: http://www.humanedge.biz/tim/testtotals.htm The extra field at the bottom is meant...
7
by: Joe Wasik | last post by:
Hello, Currently I used Biomobility's DataOnTheRun for the Pocket PC. It's a little slow, but it does exactly what I need -- and it does it well. Unfortunately, now I need to have the same...
10
by: Buck Rogers | last post by:
Hi guys! Does anyone have a link to a site that provides up to date programming book reviews? I looked through the reviews at: http://www.accu.org/bookreviews/public/index.htm ...
10
by: GML | last post by:
I have a bound datagrid in C# based on an an SQL query. The results are displayed in a Sharepoint 2003 Webpart. I would like to add a new column based on the results of two columns in the...
16
by: John A. Bailo | last post by:
I was pricing VS.NET Professional 2005 upgrade and found a good price on Amazon -- but then I read the customer reviews and they were terrible: ...
0
by: felics60 | last post by:
Lack of knowledge about computers and its accessories is a big problem if one doesn't know their subtleties and intricacies. I have been searching for these informations lately and I found that one...
6
by: =?Utf-8?B?Vk1J?= | last post by:
Where can I find aspnet web host reviews? There aren't many sites that list user reviews for asp.net web hosting. I've seen some, but it seems that they don't update the site (ie. their most...
0
by: cnb | last post by:
class Customer(object): def __init__(self, idnumber, review): self.idnumber = idnumber self.reviews = def addReview(self, review): self.reviews.append(review) def averageGrade(self): tot...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
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...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.