473,890 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Most Recent Dated Record, perhaps I am not seeing it correctly.

Experts,
I have the following scenario:

Table1: RecordID RecordDate ...

I want in a query to show me within this RecordID, only the latest
RecordDate and info. I know I can use the Max command but am not
familiar with the concept behind it, how to use it. i.e. if I pick
Max(RecordDate) in the query column, it still shows all records. If I
combine it with RecordID, same... what should I have done?

Thanks in advance,
Perry

Nov 13 '05 #1
10 1630
In the QueryBuilder window, pull down the Fields you want to see. Click on
Record Date and set Sort in Descending order. Then right-click in the upper
area, but not over a table or a join lines, and from Query Properties Select
Top 1.

Larry Linson
Microsoft Access MVP
<pe******@yahoo .com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Experts,
I have the following scenario:

Table1: RecordID RecordDate ...

I want in a query to show me within this RecordID, only the latest
RecordDate and info. I know I can use the Max command but am not
familiar with the concept behind it, how to use it. i.e. if I pick
Max(RecordDate) in the query column, it still shows all records. If I
combine it with RecordID, same... what should I have done?

Thanks in advance,
Perry

Nov 13 '05 #2
Would this show only 1 record? What I want is within the same Record#
(in the same table), there are multiple dates, I want only to show
latest date record. Therefore, I might have:

ID Date
Rc1: 101 09/25/05 (excluded Rc1 9/1/05)
Rc2: 105 10/22/05 (excluded Rc2 09/22/05, 08/14/04...)
Rc3: 111 04/25/04...

I hope this is clearer.

Perry

Nov 13 '05 #3
Larry said:
In the QueryBuilder window, pull down the Fields >>you want to see. Click on
Record Date and set Sort in Descending order. >>Then right-click in the upper
area, but not over a table or a join lines, and from >> Query Properties Select
Top 1.

Perrry said:
Would this show only 1 record? What I want is >> within the same Record#


Perry,
It should only show 1 record, because you're selecting the 'Top 1'
records... meaning only the 1st record will be shown. This will work
because you're sorting in DESC ordering by the date (most recent date
will be the 1st record in the sort)

The Max function works better in a Group By or Totals query

Nov 13 '05 #4
Larry said:
In the QueryBuilder window, pull down the Fields >>you want to see. Click on
Record Date and set Sort in Descending order. >>Then right-click in the upper
area, but not over a table or a join lines, and from >> Query Properties Select
Top 1.

Perrry said:
Would this show only 1 record? What I want is >> within the same Record#


Perry,
It should only show 1 record, because you're selecting the 'Top 1'
records... meaning only the 1st record will be shown. This will work
because you're sorting in DESC ordering by the date (most recent date
will be the 1st record in the sort)

The Max function works better in a Group By or Totals query

Mark
ac*********@aol .com

Nov 13 '05 #5

pe******@yahoo. com wrote:
Would this show only 1 record? What I want is within the same Record#
(in the same table), there are multiple dates, I want only to show
latest date record. Therefore, I might have:

ID Date
Rc1: 101 09/25/05 (excluded Rc1 9/1/05)
Rc2: 105 10/22/05 (excluded Rc2 09/22/05, 08/14/04...)
Rc3: 111 04/25/04...

I hope this is clearer.

Perry


If all the dates you want to compare are in the same record see:

http://groups-beta.google.com/group/...d211fb18?hl=en

James A. Fortune

Nov 13 '05 #6
<pe******@yahoo .com> wrote
Would this show only 1 record? What
I want is within the same Record# (in
the same table), there are multiple dates,
I want only to show latest date record.
Therefore, I might have:

ID Date
Rc1: 101 09/25/05 (excluded Rc1 9/1/05)
Rc2: 105 10/22/05 (excluded Rc2 09/22/05, 08/14/04...)
Rc3: 111 04/25/04...


Sorry, I did not understand you wanted the most recent date for each "record
type". You will need to use a Totals Query, grouping on Record#, and use the
Max on the Date field (which shouldn't be named "Date" because Date is a
reserved word).

Larry Linson
Microsoft Access MVP
Nov 13 '05 #7
Larry Linson wrote:
<pe******@yahoo .com> wrote
> Would this show only 1 record? What
> I want is within the same Record# (in
> the same table), there are multiple dates,
> I want only to show latest date record.
> Therefore, I might have:
>
> ID Date
> Rc1: 101 09/25/05 (excluded Rc1 9/1/05)
> Rc2: 105 10/22/05 (excluded Rc2 09/22/05, 08/14/04...)
> Rc3: 111 04/25/04...


Sorry, I did not understand you wanted the most recent date for each "record
type". You will need to use a Totals Query, grouping on Record#, and use the
Max on the Date field (which shouldn't be named "Date" because Date is a
reserved word).

Larry Linson
Microsoft Access MVP


I think Larry's got it. I also got confused by RecordID referring to a
group of records. RecordID looked like the primary key of your table
rather than a foreign key to another table. Ignore what I said.

James A. Fortune

Nov 13 '05 #8
Larry and James,
I sincerely thank you and appoligize for my poor explanation.
Your suggestions work to a certain extend, mostly becuase of my lack of
details here. I am beginning to think this may need a VB code instead.
Table1
Field1 Field2 Field3 Field4 ...
RC1: MedRec1 SOCDate1 CertDate1 Memo1

Example:

RC1: MedRec SOCDate CertDate Memo
100 01/01/05 01/01/05 FirstCert Period in
2005 for MR100
100 01/01/05 03/01/05 SecondCert Period
in 2005 for MR100
100 10/01/04 10/01/04 FirstCert Period in
2004 for MR100
100 10/01/05 12/01/05 SecondCert Period
in 2004 for MR100
103 02/01/05 02/01/05 FirstCert Period in
2005 for MR103
Output (perhaps via inner joint Query or VB?), shows only:

RC1: MedRec SOCDate CertDate Memo
100 01/01/05 01/01/05 FirstCert Period in
2005
100 01/01/05 03/01/05 SecondCert Period
in 2005
103 02/01/05 02/01/05 FirstCert Period in
2005 for MR103

P.S.: I will need to be able to add records in the form after the
output as well, therefore, filtering may not work.

If I had known this DB is going to transform into this, I would have
split this into 2 tables to begin with. Then, we won't have any
problem. I hate to have to go this route.

Perry

Nov 13 '05 #9
pe******@yahoo. com wrote:
Larry and James,
I sincerely thank you and appoligize for my poor explanation.
Your suggestions work to a certain extend, mostly becuase of my lack of
details here. I am beginning to think this may need a VB code instead.
Table1
Field1 Field2 Field3 Field4 ...
RC1: MedRec1 SOCDate1 CertDate1 Memo1

Example:

RC1: MedRec SOCDate CertDate Memo
100 01/01/05 01/01/05 FirstCert Period in
2005 for MR100
100 01/01/05 03/01/05 SecondCert Period
in 2005 for MR100
100 10/01/04 10/01/04 FirstCert Period in
2004 for MR100
100 10/01/05 12/01/05 SecondCert Period
in 2004 for MR100
103 02/01/05 02/01/05 FirstCert Period in
2005 for MR103
Output (perhaps via inner joint Query or VB?), shows only:

RC1: MedRec SOCDate CertDate Memo
100 01/01/05 01/01/05 FirstCert Period in
2005
100 01/01/05 03/01/05 SecondCert Period
in 2005
103 02/01/05 02/01/05 FirstCert Period in
2005 for MR103

P.S.: I will need to be able to add records in the form after the
output as well, therefore, filtering may not work.

If I had known this DB is going to transform into this, I would have
split this into 2 tables to begin with. Then, we won't have any
problem. I hate to have to go this route.

Perry


Perry,

I still don't understand how you're getting your output. Sorry. Is
any grouping done on the Memo or CertDate fields? I guess seeing two
100's for MedRec in your output threw me off track since you appeared
to want the latest of some date for a particular MedRec value. Maybe
explain in words how to get the output you want along with the example.
Additionally, make sure I understand where RC1, RC2 etc. are coming
from. If I understand how to get your output I may be able to create
the editable query you want or suggest VBA alternatives.

James A. Fortune

Nov 13 '05 #10

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

Similar topics

7
2595
by: Nova's Taylor | last post by:
Hi folks, I am a newbie to Python and am hoping that someone can get me started on a log parser that I am trying to write. The log is an ASCII file that contains a process identifier (PID), username, date, and time field like this: 1234 williamstim 01AUG03 7:44:31 2348 williamstim 02AUG03 14:11:20
3
1375
by: TJM | last post by:
hello, I have a table which contains the audit time field. This audit time field records the current date and time when a record is inserted. I would like to output the most recent top 500 rows. thank you.
1
3440
by: Tim Graichen | last post by:
Good morning, I have a sub-form that displays records from a table as a continuous form. The table has several hundred records, but the subform only displays five or six records. The records do include a date field. How can I force the sub form to display the most recent dates by default, verses forcing the user to scroll through all of the records to the bottom of the form in order to view the most recent entry or to add a new entry...
2
3881
by: Shaiguy | last post by:
I have a table containing the following fields: ProjectUpdateID (PrimaryKey) ProjectID UpdateDate I would like to create a Query in Ms Access 2000 which will return me the most recent 2 records (and also show the above 3 fields) So suppose the table looks like this:
15
4673
by: Steve | last post by:
I have a form with about 25 fields. In the BeforeUpdate event of the form, I have code that sets the default value of each field to its current value. For a new record, I can put the focus in any field to start. If I edit that field and then click on the new record button in the navigation buttons, the form goes to a new record and each field has the default value of the previous record. If I put the focus in any field to start, edit that...
1
4702
by: evenprimes | last post by:
Here's the table setup: table1: -key -name table2: -key -modification_date -phone_number
3
1196
by: Platero | last post by:
Hi, how can I get the most recent dated file (or the last created/modified) in a specified directory? Thanks
3
1843
by: AnthonyT | last post by:
Hi All I have a major problem with an access query and I am near the end of my tether! I have taken over a project with a badly built access database and as resources are not available to start over I have to make do and cobble together a fix. DB is design to record customer reviews . It was built as 1 table with 1 line per review. So as you can imagine you can have several reviews for the same customer over time.
13
4034
by: angi35 | last post by:
Hi - working in Access 2000... my goal is to combine fields from two tables in a query: Table 1 has ItemNumber and ItemDescription. There's only one record per ItemNumber. Table 2 has ItemAlias. It also has ItemNumber and LatestUsedDate. Table 2 may not have any record for an ItemNumber in Table 1; it may have one record; or it may have several records for a given ItemNumber. Sometimes the LatestUsedDate is filled in; sometimes...
0
9822
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10923
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
10462
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
7169
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
5851
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
6045
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4676
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
2
4271
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3277
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.