UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> View Report By Last Records, Access 2013    
 
   
vanzie
post May 29 2020, 05:59 AM
Post#1



Posts: 32
Joined: 29-January 19



Hi everyone

Does anyone have VBA code to view the last records you saved in a report?

I made a field in the table of the records I would like to view called DateCaptured. In the form where the information is captured, I added the field with the default value of Now.

Say for example I captured 10 documents today with different dates, I want to view the records I captured today and not the records I captured yesterday or a week ago and have it mixed with the new document dates.
Go to the top of the page
 
jleach
post May 29 2020, 07:40 AM
Post#2


UtterAccess Administrator
Posts: 10,588
Joined: 7-December 09
From: St. Augustine, FL


Hi,

You'd do this with a query: create a query and sort it descending by the DateCaptured, and limit it to the number of rows you want. The create a report based on that query.

--------------------
Jack D. Leach
Founder & CEO
Dymeng Services Inc.
Business Software Solutions
Go to the top of the page
 
June7
post May 29 2020, 12:45 PM
Post#3



Posts: 1,533
Joined: 25-January 16
From: The Great Land


Including time component complicates this. If you really don't care about time of day, then use Date() as default, not Now(). Then filter simply: DateCaptured = Date(). Otherwise, have to do some manipulation of your field.
This post has been edited by June7: May 29 2020, 01:28 PM

--------------------
Attachments Manager is below the edit post window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Go to the top of the page
 
projecttoday
post May 29 2020, 01:16 PM
Post#4


UtterAccess VIP
Posts: 12,404
Joined: 10-February 04
From: South Charleston, WV


In your query the function DateDiff("d",yourdatefield,Date()) will return 0 regardless of the time component in your date field. So you can use "WHERE DateDiff("d",yourdatefield,Date()) = 0" to get records for the current date.

--------------------
Robert Crouser
Go to the top of the page
 
vanzie
post Jun 1 2020, 02:47 AM
Post#5



Posts: 32
Joined: 29-January 19



@projecttoday I removed the WHERE Clause because it gave me the operator error but still works as you suggested.

Go to the top of the page
 
projecttoday
post Jun 1 2020, 02:56 AM
Post#6


UtterAccess VIP
Posts: 12,404
Joined: 10-February 04
From: South Charleston, WV


You must have a WHERE clause if you don't want to see all the records in the table.

--------------------
Robert Crouser
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    13th July 2020 - 06:23 AM