How to print all the records after each working day

113hans

Member
Local time
Today, 23:35
Joined
Mar 31, 2021
Messages
47
Hi guys
I can print a current record using the command button I put in my sample
but I have to click 1 by 1 for each client
so I wish the button can print all the records after each working day in 1 click only
I think the code have to have a filter following the daily time or something like that
just don't know how to do it, please help me.

Here my sample
 

Attachments

If you have a date/time field then you could have something like this "air code."

Code:
SELECT bunch-of-fields FROM working-table WHERE DATE(entry-date-field) = DATE(NOW()) .... and other criteria.
 
docmd.openreport "Report1",,,"Transdate=Date()"
 
Yeah, Pat, I've developed some sloppy habits. Date() by itself implies TODAY so could have left that out. Would have worked, but was sloppy.
 
If you have a date/time field then you could have something like this "air code."

Code:
SELECT bunch-of-fields FROM working-table WHERE DATE(entry-date-field) = DATE(NOW()) .... and other criteria.
"Syntax error" the access-brother told me.
 
When we send you "air code" it is not expected to run. It is just an example where you have to fill in the blanks with your list of fields, proper table names, and whatever other criteria are used for your selection. Since I don't open other people's databases for security reasons (... OK, I'm paranoid), I didn't know the field names and table names to use.
 
DATE(NOW()) is not valid syntax

CDATE maybe but that would keep the hours/minutes with NOW()
 
When we send you "air code" it is not expected to run. It is just an example where you have to fill in the blanks with your list of fields, proper table names, and whatever other criteria are used for your selection. Since I don't open other people's databases for security reasons (... OK, I'm paranoid), I didn't know the field names and table names to use.
Not that paranoid, I think you just choose to see the risk that people usually miss.
 
I encounter some error messages
Capture.PNG
Capture.PNGa.PNG

Don't know how to know it 😅
 
your Date Separator is Dot (.).
try this, I change the WhereCondition of OpenReport to:

IIf(Me.lstDayToPrint <> "All", "TransDate=#" & Format$(Replace$(Me.lstDayToPrint, ".", "/"), "mm/dd/yyyy") & "#", "(1=1)")
 

Attachments

You mean this
Capture.PNGh.PNG

I should change it to what: 01 - 04 - 2024 or 01 / 04 / 2024
 
if the last db i posed is working, no need to change your Locale Date/Time format.
 

Users who are viewing this thread

Back
Top Bottom