Broken Calendar Control in MS Access 2007 - How can extra methods and attributes be a

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SurgeArrester
    New Member
    • Sep 2013
    • 4

    Broken Calendar Control in MS Access 2007 - How can extra methods and attributes be a

    I have inherited an Access Database that seems to work in Access 2003 and earlier but not in 2007 and later, and the issue is around a custom-built calendar control which appears to be similar to the existing MS calendar control but with some extra methods added such as "cal.ISOWee k", "cal.ISODay ", based on ISO calendar system. There is no documentation for this control, and I've no idea who created it - probably long since left the company.
    Is there any way of adding methods to a calendar control in Access 2007 that would allow me to get similar functionality?
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    SurgeArrester
    Well, the answer is both yes and no...
    We don't know what your custom functions do; however, you might take a look at the following and see if it helps:
    Replacing the Calendar Control in Access 2010 Applications
    I realize the link is for 2010; however, this should also work for 2007, if not, you know where to come for help (^.-)

    z

    Comment

    • SurgeArrester
      New Member
      • Sep 2013
      • 4

      #3
      Thanks zmbd - I had seen some of those microsoft suggestions, but figured I'd ask on a forum such as this too!

      As far as I can see, there are some extra attributes assigned to the calendar object - for instance it will return the isoweek value based on the current date. ISO weeks sometimes start the last week of the previous year, or sometimes start two or three days into the new year. (Some years will have 53 ISO weeks, and other years have only 52 ISO weeks)
      Thus in the vba scripts associated with the various forms in the db, one can see things like:
      Code:
      dim cal as object
      set cal = [Forms]![Calendar]!Calendar_XXXX
      cal.isoweek = 10
      What I am interested in is if I create a new calendar in a form, and rename it so Calendar_XXXX, is there a way to add in attributes such as cal.isoweek which are either settable, or which default to the ISO week value based on the current date or the date in the calendar? Calculating the ISO week is easy enough - there's various algorithms to do it, but as a bit of an access / vba novice, I am more interested in the bit about the attributes and if there's a simple fix available.
      Last edited by zmbd; Sep 27 '13, 03:54 PM. Reason: [z{please format poste code/sql/formated text using the [CODE/] button}]

      Comment

      • zmbd
        Recognized Expert Moderator Expert
        • Mar 2012
        • 5501

        #4
        (1) Modifying the built in controls is very much beyond both thus forum and the novice programmer. So the simple answer to the question is more than likely, no. Now ADezii, Rabbit, Neopa have a bit more experince about these things; thus they may have a solution to modify a built in control; however, I suspect not one that is easy.

        (2) Let us take a look at your "custom control." Normally, I think we would need to start a new thread; however, for now, let's see if we can work thru the control you are having issues with:
        (2a) You're working with a custom control or form. From the code you posted, it appears that there should be a form in the database called "calendar" and not an actual add-in control. This form is where you're going to have to dive into the code.
        (i) Are you receiving any errors? IF so, then please post them exactly as given, title, number, and text. If the code takes you into the VBA editor in debug mode (the line where the error is suspected is by default selected and highlighted (usually in yellow)) then also post that section of code... a few lines before and after the suspected error AND indicate which line had the error. Please remember to select the posted code and format it using the [CODE/] button.

        (ii) If you are not receiving an error, then in a few sentences, describe what is happening and that differs from the desired result.

        Comment

        • SurgeArrester
          New Member
          • Sep 2013
          • 4

          #5
          When I start up the database in Access 2007, I get "run time error '438' - Object doesn't support this property or method".
          The offending code is as follows:
          Code:
          Sub Main_Form_Issue()
          Dim cal As Object
          DoCmd.OpenForm "Calendar", , , , , acHidden
          
          Set cal = [Forms]![Calendar]!CalendarESBNG
          
          
          If cal.ESBWeek < 10 Then
              [Forms]![main form]![Data Issue] = "1.0" & cal.ESBWeek
          Else
              [Forms]![main form]![Data Issue] = "1." & cal.ESBWeek
          End If
          [Forms]![main form]![Date] = cal.Day & "/" & cal.Month & "/" & cal.Year
          
          DoCmd.Close acForm, "Calendar"
          End Sub
          The error is generated by the first cal.esbweek line (esbweek is the same as isoweek). The name of the calendar on the form is CalendarESBNG. What should happen is that a main form should open, presenting the user with various options around reporting, entering new data etc...fairly mundane stuff. (DB at link - change zap to zip)

          Comment

          • zmbd
            Recognized Expert Moderator Expert
            • Mar 2012
            • 5501

            #6
            Find either the form or the class module named "CalendarES BNG" in the database.
            - The form should be visible in the navigation panel under the forms group ( ok, that's obvious; however, often the subgroups are collapsed so one doesn't always see them).
            - If it's a class module, then you'll only see this in the VBA editor in the projects tree.

            Once we locate that, then we can start finding out why the property of method "ESBWeek" isn't working.

            Comment

            • SurgeArrester
              New Member
              • Sep 2013
              • 4

              #7
              There is a form called Calendar with a blank box where the calendar control should be! When you look at the properties, CalendarESBNG is an ActiveX control, which looks as if it was custom written, but is no longer being picked up by the database. The 'class' is ESBNGCalendar.E SBCalendar, rather than a more typical microsoft calendar class, which leads me to believe that whoever wrote the db modified or created their own activex calendar control. If you want to see for yourself, there's a link to the actual db in my previous msg. There aren't any class modules with code for the calendar functions or anything like that.
              Hence it looks like the best way to fix this would be to insert a new standard calendar control and try to add in the functionality for 'isoweek' type things. Any thoughts?

              Comment

              Working...