Solved Form to report transition (1 Viewer)

jazsriel

Member
Local time
Today, 16:56
Joined
Dec 21, 2020
Messages
51
Hi again everyone. Well, my problem today is probably something very simple but still seems to be eluding me. So, in the DB I have uploaded, if you open the form and then type in a date, any date in the format I have indicated on the form and then click the button to open the report associated with this form. What will happen is the report will open, but does not show the month and year in the appropriate sections in the top right of the report. Which is the problem.

Now the only work around I have at the moment is to simply tab through to a new record on the form, then click the button to open the report and then it will show the month and year as I need it to.

So the solution I am looking for is a way to type in the date on the form, then click the button to open the report without having to tab through the form to get it to register on the report. If it helps, I do not have to keep the form open when the report opens, in fact I prefer the form to close, but I simply left open when the report opens for asking for help with this problem.

If any of this is confusing please let me know and I will try to clarify what I am saying more if I can, but thank you for any help or at least even reading my post.
 

Attachments

  • Test.accdb
    2.4 MB · Views: 72

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:56
Joined
May 7, 2009
Messages
14,607
before Opening the report you must save the record.
on your code add this:

'arnelgp
'force save the record
Me.Dirty = False
DoCmd.OpenReport "rptCasesCountblank", acViewPreview, "", "", acNormal

you must also Change your qryCaseCountBlank to return
1 record only:

SELECT TOP 1 tblCaseCountBlank.*,
Month([Date]) AS DateMonth, Format([date],"mmmm") AS Expr1,
Year([Date]) AS Expr2, Format([date],"d") AS Expr3
FROM tblCaseCountBlank ORDER BY ID DESC;
 

jazsriel

Member
Local time
Today, 16:56
Joined
Dec 21, 2020
Messages
51
Gotcha. I made the adjustments and it works perfectly. I very much appreciate the quick reply.
 

Users who are viewing this thread

Top Bottom