How to print all the records after each working day (1 Viewer)

113hans

Member
Local time
Tomorrow, 04:43
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

  • samplePrintSelectedRecord.accdb
    984 KB · Views: 48

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 16:43
Joined
Feb 28, 2001
Messages
27,188
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.
 

Cronk

Registered User.
Local time
Tomorrow, 07:43
Joined
Jul 4, 2013
Messages
2,772
docmd.openreport "Report1",,,"Transdate=Date()"
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 16:43
Joined
Feb 28, 2001
Messages
27,188
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.
 

113hans

Member
Local time
Tomorrow, 04:43
Joined
Mar 31, 2021
Messages
47
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.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 16:43
Joined
Feb 28, 2001
Messages
27,188
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.
 

Cronk

Registered User.
Local time
Tomorrow, 07:43
Joined
Jul 4, 2013
Messages
2,772
DATE(NOW()) is not valid syntax

CDATE maybe but that would keep the hours/minutes with NOW()
 

113hans

Member
Local time
Tomorrow, 04:43
Joined
Mar 31, 2021
Messages
47
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.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:43
Joined
May 7, 2009
Messages
19,245
here you can check "Arnel'l Print" button.
 

Attachments

  • samplePrintSelectedRecord2.accdb
    1.6 MB · Views: 48

113hans

Member
Local time
Tomorrow, 04:43
Joined
Mar 31, 2021
Messages
47
I encounter some error messages
Capture.PNG
Capture.PNGa.PNG

Don't know how to know it 😅
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:43
Joined
May 7, 2009
Messages
19,245
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

  • samplePrintSelectedRecord2.accdb
    1.6 MB · Views: 47

113hans

Member
Local time
Tomorrow, 04:43
Joined
Mar 31, 2021
Messages
47
You mean this
Capture.PNGh.PNG

I should change it to what: 01 - 04 - 2024 or 01 / 04 / 2024
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:43
Joined
May 7, 2009
Messages
19,245
if the last db i posed is working, no need to change your Locale Date/Time format.
 

Cronk

Registered User.
Local time
Tomorrow, 07:43
Joined
Jul 4, 2013
Messages
2,772
I put your code
And I wrote
Code:
  Docmd.OpenReport

And you put
Code:
 Docmd.outputTo

You'll see ArnelGP also uses docmd.OpenReport
 

113hans

Member
Local time
Tomorrow, 04:43
Joined
Mar 31, 2021
Messages
47
And I wrote
Code:
  Docmd.OpenReport

And you put
Code:
 Docmd.outputTo

You'll see ArnelGP also uses docmd.OpenReport
I tried to adapt to my aim 😅
Here I use only your code, it just print a current record, not all records in one day.
 

Attachments

  • samplePrintSelectedRecord3.accdb
    1.6 MB · Views: 43

Users who are viewing this thread

Top Bottom