473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

MS Access Calendar - Need help with parameters

I am using Access 2013 with Windows 7.

I am modifying this calendar:

https://bytes.com/topic/access/answers/761255-ms-access-calendar

I am getting a "Too few parameters - Expected 5" error message.

Are any other users of this calendar available to help with some modifications?

I am tracking Goals by date, not Events.

It appears that there hasn't been any activity with this app in a few years. I am hoping that ADezii is still involved with it.

Sidebar: I have spent countless hours looking for a form-based calendar that would, among other criteria, not be dependent on mscal.ocx or ActiveX controls. This calendar is fantastic!

Thank you,

Steve
Mar 28 '16 #1

✓ answered by ADezii

  1. Rather than work within the context of your Database, I found it easier to create a New Database and Import the key Components into it, namely: the Calendar Table and DailyGoals Form. It now becomes a simple matter to integrate this new functionality into your Database by simply Importing frmCalendar and the Code Modules into it.
  2. When you Open the Demo you will see frmCalendar displayed along with your requested key Fields for each Day Block.
  3. Dbl-Clicking on a Day Block/Date will open DailyGoals with Data for that specific Date.
  4. Make any changes in DailyGoals then click the Close Button in the lower left corner.
  5. To see any changes that you made on the Calendar, click on the Sync Button in the lower left corner.
  6. If you are not interested in seeing these changes immediately, you can move to any other Month or Year and return to the modified Date. The Calendar will now be in sync in the Calendar Table.
  7. The ListBox functionality on the bottom of frmCalendar has been disabled since I saw no need for it in this current scenario.
  8. This is the essence of the Access Calendar. Download the Attachment and good luck with your Project.
P.S. - If you would like to have frmCalendar reflect any changes made on DailyGoals immediately you can Call the PopulateCalendar() Routine within the DblClick() Event of each Day Block. This will work since DailyGoals will be opened in Dialog Mode and the line of Code after the OpenForm() Method will not execute until after the Form is closed. Sorry if my explanation is confusing, but here is an example for Day Block #7:
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtDayBlock07_DblClick(Cancel As Integer)
  2.   DoCmd.OpenForm "DailyGoals", acNormal, , "[DateTime] = #" & CDate(Me![txtDayBlock07].Tag) & "#", acFormEdit, acDialog
  3.     PopulateCalendar
  4. End Sub

20 1515
PhilOfWalton
1,430 Expert 1GB
This screenshot is of a calendar I wrote years ago. Any help?

Phil

Mar 28 '16 #2
Hi Phil,

Looks great! Is that a variation of:

https://bytes.com/topic/access/answe...ccess-calendar

If so, I could use a couple of pointers.

Thank you.

Steve
Mar 29 '16 #3
PhilOfWalton
1,430 Expert 1GB
Regret my Calendar is completely different. It consists of 42 continuous subfoms which (as the picture shows) allows different colours to represent different kinds of event (e.g. Blue - Social, green - work, brown - Club Committee meetings). The main problem is that it takes about 2 seconds to load a month as there are a lot of subforms to fill.

Phil
Mar 29 '16 #4
ADezii
8,834 Expert 8TB
Can you Upload your Database stripped of any sensitive Data along with a detailed explanation of exactly what is not working?
Mar 29 '16 #5
Hi ADezii,

Thank you for your reply.

Absolutely. I very much appreciate your help.

I will be able to strip the database later this evening. I'm in Oregon (PDT). I will upload it as soon as it is ready, along with a detailed explanation.

Thanks again!

Steve
Mar 29 '16 #6
Hi ADezii,

I have stripped the db.

The original calendar displays a datasheet under the calendar. Instead of displaying a datasheet, I want to doubleclick on a date and open a form (DailyGoals). I also want to display the data, for each of the following fields, within each respective date (DayBlock) on the Calendar:

Calendar.NPGoal
Calendar.PVGoal
Calendar.ROFArrived
Calendar.CPRArrived
Calendar.REVGoal

My Calendar table does not have any Start Time or End Time related fields.

I have tried to duplicate the changes that RockKandee made when you helped them, with limited success.

Currently, I am getting the following error, when I launch the Calendar:

Item not found in this collection.

I could use some help with the SELECT statements, given the fields in my Calendar table.

Thank you, once again,

Steve
Attached Files
File Type: zip GoalsTrackingSystem Stripped.zip (234.8 KB, 72 views)
Mar 29 '16 #7
ADezii
8,834 Expert 8TB
I am extremely busy at work right now, but as soon as I get a chance, I'll be happy to look at the Database.
Mar 30 '16 #8
Hi ADezii,

I completely understand. I appreciate any help you can lend, very much.

I have made progress and am attaching the latest version.

Everything seems to be working fine. The subform populates correctly.

The one thing that I still haven't been able to figure out is populating each date with:

CalendarQ.NPGoal
CalendarQ.PVGoal
CalendarQ.ROFArrived
CalendarQ.CPRArrived
CalendarQ.REVGoal

I believe it has to do with the fact that I do not have a Start Time, End Time or Title.

Once I am able to display the data, I want to be able to double click the date and launch the DailyGoals form, for that respective date.

Once again, I appreciate any coaching you can provide and am very patient. :-)

Take care,

Steve
Attached Files
File Type: zip GoalsTrackingSystem Stripped2.zip (219.7 KB, 61 views)
Mar 30 '16 #9
ADezii
8,834 Expert 8TB
The one thing that I still haven't been able to figure out is populating each date...
Here is a partial Code Segment that should at least point you in the right direction:
Expand|Select|Wrap|Line Numbers
  1. 'CODE INTENTIONALLY OMITTED
  2. Set db = CurrentDb
  3.  
  4. strSQL = "SELECT Calendar.CalendarID, Calendar.DateTime, Calendar.NPGoal, Calendar.PVGoal, Calendar.ROFArrived, " & _
  5.          "Calendar.CPRArrived, Calendar.REVGoal FROM Calendar WHERE Calendar.DateTime BETWEEN %F And %L ORDER BY " & _
  6.          "Calendar.CalendarID"
  7. strSQL = Replace(strSQL, "%F", lngFirstOfMonth)
  8. strSQL = Replace(strSQL, "%L", lngLastOfMonth)
  9.  
  10. Set rstEvents = db.OpenRecordset(strSQL)        'Added 4/16/2008
  11.  
  12. With rstEvents
  13.   Do While Not .EOF
  14.     'CFB added 2-18-10
  15.     lngFirstDateInRange = ![DateTime]        '<Substitute for [Start Date], if Date Range>
  16.     If lngFirstDateInRange < lngFirstOfMonth Then
  17.       lngFirstDateInRange = lngFirstOfMonth
  18.     End If
  19.     lngLastDateInRange = ![DateTime]         '<Substitute for [End Date], if Date Range>
  20.     If lngLastDateInRange > lngLastOfMonth Then
  21.       lngLastDateInRange = lngLastOfMonth
  22.     End If
  23.  
  24.     For lngEachDateInRange = lngFirstDateInRange To lngLastDateInRange
  25.       bytEventDayOfMonth = (lngEachDateInRange - lngLastOfPreviousMonth)
  26.       bytBlockCounter = bytEventDayOfMonth + bytBlankBlocksBefore
  27.         If astrCalendarBlocks(bytBlockCounter) = "" Then      'no existing Text in Array
  28.           astrCalendarBlocks(bytBlockCounter) = "NPGoal: " & rstEvents![NPGoal] & vbCrLf & "PVGoal: " & rstEvents![PVGoal] & _
  29.                                                  vbCrLf & "ROFArrived: " & rstEvents![ROFArrived] & vbCrLf & "CPRArrived: " & _
  30.                                                  rstEvents![CPRArrived] & vbCrLf & "REVGoal: " & rstEvents![REVGoal]
  31.         Else
  32. 'CODE INTENTIONALLY OMITTED
  33.  
Mar 30 '16 #10
Thank you, ADezii.

Currently, the code looks like this:

Expand|Select|Wrap|Line Numbers
  1. Set db = CurrentDb
  2.  
  3. 'CFB added 2-18-10
  4. '<Substitute your own SQL Statement here>
  5. strSQL = "SELECT Calendar.[CalendarID], Calendar.[DateTime], Calendar.[NPGoal], Calendar.[PVGoal], Calendar.[ROFArrived], " & _
  6.          "Calendar.[CPRArrived], Calendar.[REVGoal] FROM Calendar WHERE Calendar.DateTime BETWEEN %F And %L ORDER BY " & _
  7.          "Calendar.[CalendarID]"
  8. strSQL = Replace(strSQL, "%F", lngFirstOfMonth)
  9. strSQL = Replace(strSQL, "%L", lngLastOfMonth)
  10.  
  11. Set rstEvents = db.OpenRecordset(strSQL)    'Added 4/16/2008
  12.  
  13.  
  14. With rstEvents
  15. Do While Not .EOF
  16.   'CFB added 2-18-10
  17.     lngFirstDateInRange = ![DateTime]        '<Substitute for [Start Date], if Date Range>
  18.     If lngFirstDateInRange < lngFirstOfMonth Then
  19.       lngFirstDateInRange = lngFirstOfMonth
  20.    End If
  21.   lngLastDateInRange = ![DateTime]         '<Substitute for [End Date], if Date Range>
  22.  If lngLastDateInRange > lngLastOfMonth Then
  23.       lngLastDateInRange = lngLastOfMonth
  24.     End If
  25.  
  26.     For lngEachDateInRange = lngFirstDateInRange To lngLastDateInRange
  27.       bytEventDayOfMonth = (lngEachDateInRange - lngLastOfPreviousMonth)
  28.       bytBlockCounter = bytEventDayOfMonth + bytBlankBlocksBefore
  29.  
  30.  
  31.         If astrCalendarBlocks(bytBlockCounter) = "" Then      'no existing Text in Array
  32.           astrCalendarBlocks(bytBlockCounter) = "NPGoal: " & rstEvents![NPGoal] & vbCrLf & "PVGoal: " & rstEvents![PVGoal] & _
  33.                                                  vbCrLf & "ROFArrived: " & rstEvents![ROFArrived] & vbCrLf & "CPRArrived: " & _
  34.                                                  rstEvents![CPRArrived] & vbCrLf & "REVGoal: " & rstEvents![REVGoal]
  35.         Else
  36.         strStartTime = Format$(rstEvents![Start Time], "Short Time")       '<Substitute for [Start Time]>
  37.         'strStartTime = Format$(rstEvents![Start Time], "h:mm AM/PM")       '<Substitute for [Start Time]>
  38.       End If
  39.                                               '<Substitute for [Title]>
  40.       If astrCalendarBlocks(bytBlockCounter) = "" Then
  41.           astrCalendarBlocks(bytBlockCounter) = "NPGoal: " & rstEvents![NPGoal] & vbCrLf & "PVGoal: " & rstEvents![PVGoal] & _
  42.                                                  vbCrLf & "ROFArrived: " & rstEvents![ROFArrived] & vbCrLf & "CPRArrived: " & _
  43.                                                  rstEvents![CPRArrived] & vbCrLf & "REVGoal: " & rstEvents![REVGoal]
  44. '        astrCalendarBlocks(bytBlockCounter) = rstEvents![Title] & vbNewLine & strStartTime
  45.  
  46.       Else                                    '<Substitute for [Title]>
  47. '       astrCalendarBlocks(bytBlockCounter) = astrCalendarBlocks(bytBlockCounter) & vbNewLine & _
  48. '                                              rstEvents![Title] & vbNewLine & strStartTime
  49.       End If
  50.   Next lngEachDateInRange
  51.   'End of CFB added 2-18-10
  52.  
  53.     rstEvents.MoveNext
  54. Loop
  55.  
I am getting a "Compile error: Expected End With" message.

When you have a moment, could you please point to where this is bombing?


Also, in version 2, I was pulling from the CalendarQ query. You pulled directly from the Calendar table. Is there any reason for not pulling from the query?

Thank you for your continuing help, ADezii. :-)

Steve
Mar 30 '16 #11
ADezii
8,834 Expert 8TB
I am getting a "Compile error: Expected End With" message.
You are only looking at a 'Code Segment' in PopulateCalendar() and not the Code in its entirety.

Also, in version 2, I was pulling from the CalendarQ query. You pulled directly from the Calendar table. Is there any reason for not pulling from the query?
None
P.S. - Be patient and I'll have a working Demo for you in a day or two.
Mar 30 '16 #12
Thank you, ADezii!

In the meantime, I will continue to hammer away at it.

My coding skills are 20+ years old and I'm grappling with If, Then Else logic. At my age, being the student is a welcome state. :-)

If I am able to show progress, I will post Version 3.

My patience will meet, or exceed, your expertise and efforts to help with this. :-)

Thank you, once again, for helping with this.

Steve
Mar 30 '16 #13
ADezii
8,834 Expert 8TB
  1. Rather than work within the context of your Database, I found it easier to create a New Database and Import the key Components into it, namely: the Calendar Table and DailyGoals Form. It now becomes a simple matter to integrate this new functionality into your Database by simply Importing frmCalendar and the Code Modules into it.
  2. When you Open the Demo you will see frmCalendar displayed along with your requested key Fields for each Day Block.
  3. Dbl-Clicking on a Day Block/Date will open DailyGoals with Data for that specific Date.
  4. Make any changes in DailyGoals then click the Close Button in the lower left corner.
  5. To see any changes that you made on the Calendar, click on the Sync Button in the lower left corner.
  6. If you are not interested in seeing these changes immediately, you can move to any other Month or Year and return to the modified Date. The Calendar will now be in sync in the Calendar Table.
  7. The ListBox functionality on the bottom of frmCalendar has been disabled since I saw no need for it in this current scenario.
  8. This is the essence of the Access Calendar. Download the Attachment and good luck with your Project.
P.S. - If you would like to have frmCalendar reflect any changes made on DailyGoals immediately you can Call the PopulateCalendar() Routine within the DblClick() Event of each Day Block. This will work since DailyGoals will be opened in Dialog Mode and the line of Code after the OpenForm() Method will not execute until after the Form is closed. Sorry if my explanation is confusing, but here is an example for Day Block #7:
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtDayBlock07_DblClick(Cancel As Integer)
  2.   DoCmd.OpenForm "DailyGoals", acNormal, , "[DateTime] = #" & CDate(Me![txtDayBlock07].Tag) & "#", acFormEdit, acDialog
  3.     PopulateCalendar
  4. End Sub
Attached Files
File Type: zip GoalsTrackingSystem_Revised.zip (63.4 KB, 68 views)
Mar 31 '16 #14
Thank you AZDezii!

I am in a long meeting this morning. I look forward to working on this, immediately after my meeting.

You are the best.

Your reputation, at bytes.com, as generous and knowledgeable are highly deserved.

Thank you!!

Steve
Mar 31 '16 #15
ADezii
8,834 Expert 8TB
Thank you Steve for the kind compliments. I'll check in again tomorrow to see how you made out - off to work right now.
Mar 31 '16 #16
Hi ADezii,

You nailed it! Your revised version resolved all of my issues, taught me much and added some things that I hadn't considered.

I can't thank you enough for your generosity and help.

As I went through the revised db and looked at how you did things that I had spent many hours struggling with, I felt like I was opening a Christmas present.

Thank you very much!

Take care,

Steve
Apr 1 '16 #17
ADezii
8,834 Expert 8TB
You are quite welcome, good luck with your Project.
Apr 1 '16 #18
ADezii
8,834 Expert 8TB
I had some spare time and I decided to increase the functionality of the Calendar by utilizing the List Box at the bottom of frmCalendar. It was there anyway just taking up space, so why not use it? (LOL).
Attached Files
File Type: zip GoalsTrackingSystem_Revised_2.zip (63.9 KB, 71 views)
Apr 2 '16 #19
Thank you very much, ADezii.

You continue to amaze!

I am attaching the latest version of the calendar. I was able to fit all 10 categories within each date.

With this in place, I'm not sure whether to add the datasheet back in. What do you think?

I am attaching a screen capture.

I couldn't have done it without your help.

Thank you, again.

Steve
Attached Images
File Type: jpg Calendar1.jpg (104.6 KB, 229 views)
Apr 2 '16 #20
ADezii
8,834 Expert 8TB
I couldn't have done it without your help
I am sure that you could have, just would have taken a little longer. Project looks great - we are always here should you need us.
Apr 2 '16 #21

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: eagleofjade | last post by:
I am trying to help a friend who is learning VB.net in school. I have done VB programming for a number of years using VB 6. He needs to open a query in an Access database that has parameters so he...
1
by: Michael | last post by:
Hi. I am working with classic ASP. I'd like to transfer al my hard coded sql queries to access stored queries and use them with parameters. Actually, I did not find any strong information how to do...
340
by: MyWaterloo | last post by:
This thread has been closed as it has gotten just too big. If you have any questions about the application discussed in this thread please start a new thread in MS Access by clicking on the Start...
10
ADezii
by: ADezii | last post by:
MS Access Calendar – OVERVIEW Many times over the years, a similar type question has been asked of us here at Bytes, namely: How Can I Incorporate Calendar Like Functionality Solely Within The...
10
RockKandee
by: RockKandee | last post by:
Hi, I am getting an error message when trying to print. I am using the MS access calendar found here: http://bytes.com/topic/access/answers/761255-ms-access-calendar I have Windows 8 and...
3
RockKandee
by: RockKandee | last post by:
I am using the MS Access Calendar in Access 2013, Windows 8. http://bytes.com/topic/access/answers/761255-ms-access-calendarhttp:// Currently I am using 4 calendar forms with the data source...
10
RockKandee
by: RockKandee | last post by:
I am using the MS Calendar found on this site with Access 2013 on Windows 8. http://bytes.com/topic/access/answers/761255-ms-access-calendar I am working on adding a form that opens from a day...
26
RockKandee
by: RockKandee | last post by:
Hi! I am using Access 2013 with Windows 8 I am working with this calendar http://http://bytes.com/topic/access/answers/761255-ms-access-calendar I would like to know if there is a quick...
5
by: Seroki | last post by:
So I found the great Calendar here on this forums and it seems to meet a good deal of my current project for my wife. A bit of background my Wife insist on paying the bills well she is always...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.