Solved

Click day in ActiveX Calendar in Access to call a report

Posted on 2011-03-21
9
265 Views
Last Modified: 2012-08-13
Hello! I'm trying to set up an OnClick action that will allow users to click on a specific day on an ActiveX calendar added to an Access database. The click would call a report that would show that specific day's activities. OnClick doesn't seem to be working. I can get the report to open whenever I open the Calendar form but not by clicking on individual buttons. So, 1) how can I get a report to open by clicking on an individual day? and 2) what is the proper way to reference the specific day that is clicked on in the calendar when using it in the code? Your assistance is greatly appreciated!
0
Comment
Question by:behest
  • 5
  • 4
9 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35186741
What version of Access please?

You have to use the AfterUpdate event of the calendar control

Something like this to open a report with the same day as the calendar

DoCmd.OpenReport "rptOrders", acViewPreview, , "OrderDate=" & "#" & Calendar6 & "#"

Works fine for me

;-)

JeffCoachman
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 35186774
In retrospect you may be better off putting the code on a button.

Putting it on the After update event will be frustrating if the user picked the wrong date by accident.
It will also not work if you add more report criteria on your form...

Sample attached

;-)

JeffCoachman
Access-EEQ26902276SynchronizeAcc.mdb
0
 

Author Comment

by:behest
ID: 35212646
Jeff, thank you for the response. I tried using the line of code provided but still have the same issue. The daily report opens but is in no way linked to the square/day clicked on the calendar. I've got basic code that will return the day, month and year values for each day of the calendar that is clicked, so I know the data is in there somewhere. Is there something along the lines of Calendar1.value (or ~) that will allow me to link the specific day clicked?

OR

Looking at this from another perspective, could I link Calendar1.value to the specific date square via the expressions on the report, currently using  =Date() ...
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35222049
<I tried using the line of code provided but still have the same issue.>
Which line of code?, the code I posted here, ...or the code from the sample Database I posted?

Remember you must change the names in the code to match the names in your specific database.

<I've got basic code that will return the day, month and year values for each day of the calendar>
Well, the calendar will return a single date.
This is all that is needed to filter the report.

Did you verify this functionality in the sample DB I posted?

JeffCoachman
Access-EEQ26902276SynchronizeAcc.mdb
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:behest
ID: 35243698
Jeff, I just received an inactive question messge. I'm in the middle of another project but will take a look at this again later this evening. Yes, I did test and replaced appropriate names in the code. More later....
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35246521
ok
0
 

Author Comment

by:behest
ID: 35310702
Hi! Back to this project now and working on setting up a new report that will work with your brilliance! Instead of a sales date, I've got start and end dates, so I need to pull anything within those dates. Hoping I can use something as simple as >= on the report. Will be back with the results.
0
 

Author Comment

by:behest
ID: 35311495
Everything is set up, the world should be a happy place to live in...but no. I'm told that I'm missing an operator. error 3075...syntax error (missing operator) in query expression 'Start date=#3/9/2011#'. It appears to want something between the "Start date=" and "#". I'm in 2007, btw. When I run yours it works without a problem. I don't have anything set up with >=...starting off simple to make sure it works then will grow from there. Any words of wisdom?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35347727
1. I thought you were using the calendar control to select the day?
2. Try to avoid using spaces in your names, ...but if your app is already designed with them, try it like this:
    "[Start Date]=" & "#" & Calendar6 & "#"

...This, again, presumes that you are using a calendar control to select the dates
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now