• Problem returning Date from Control? (A2k (9.0.3821) SR-1)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Problem returning Date from Control? (A2k (9.0.3821) SR-1)

    Author
    Topic
    #380571

    Problem returning Date from Control?
    A2k (9.0.3821) SR-1

    I have a form with date control that has an Double Click with =PopupCalendar([Screen].[ActiveControl]) and it works OK.

    I

    Viewing 2 reply threads
    Author
    Replies
    • #637824

      The returned value is ignored for a function you put in an Event property. Therefore, everything you want done you must do in the called function. I’d do it this way:
      =PopupCalendar([txtDate2])

      I assume your function is probably defined something like this:
      Public Function PopupCalendar(ctl as control)

      So, all you need to do is add a line in this function: ctl = selectedDate

      • #637868

        Hi Mark

        The reason I wanted to put it in the [Event Procedure] was so I could conditionally fire an after upde event

        Private Sub txtDate2_DblClick(Cancel As Integer)

        Me.txtDate2 = PopupCalendar(Screen.ActiveControl)

        txtDate2_AfterUpdate ‘ Opt/Mod

        End Sub

        How would I have to change popup mod to accommodate this

        John

        • #637872

          Sorry to butt in , but does this help.

          • #637991

            Hi Dave

            I see the form in the db you posted, where is the pickdate function?

            John

            • #638010

              John I use the calender as posted earlier, to control a subform, showing currently booked out cars.
              Its an activeX one though, but quite easy to manipulate.
              See code and pic attached.

              You may have to register it first. MSCAL.Calendar.7

              I ‘ve previously been quite succesful with the date & tima picker.

              As said earlier, their are loads of different variations on the web.

        • #637902

          I could be on the wrong track here – and I apologise in advance for also butting in. But if all you want is today’s date in your control why use the popup calendar? Why not
          Private Sub txtDate2_DblClick(Cancel As Integer)

          Me.txtDate2 = Date
          end sub

        • #637917

          John,

          Well I’m confused. I guess I misread your first post, but I thought you had it in a event procedure, but wanted to move it to a simple function that would be in the DblClick property?

    • #637910

      What I found was to replace the line:
      ‘ Me.txtDate2 = PopupCalendar(Screen.ActiveControl)
      with
      Call PopupCalendar(Me.txtDate2)

      HTH
      Pat smile

      • #637989

        Hi Pat

        That seems to work.

        Just to review for others this is a calendar, calculator, text popup that Mark L posted a while ago.

        I have a form with date control that has an Double Click with =PopupCalendar([Screen].[ActiveControl]) and it works OK.

        I

    • #637963

      Just a thought, I think this thread is solved, but there a ton of form based popup calendars out there. (I have one on my site.). This doesn’t seem like a very tricky issue, but having a form based calendar has several advantages. The biggest is that you are not using an ActiveX control that must be setup on the client machines. The second, you have code that you can modify, to custom fit the application.

      Drew

      • #637987

        Hi Drew

        I tried downloading minicalndar several times when opening in both a97 & a2k access closes and I’m returned to the desktop.

        Any suggestions?

        Thanks, John

        • #638001

          Sorry about that. In 97, when Access ‘disappears’ you should have a form on your desktop. In 2000, it’s a version issue. Access 2000 handles windows a bit differently. In either case, Access is still running. I have a module that hides/shows the Access window, and I put it in the MiniCalendar to show how to use it. There is a AutoKeys macro, where if you hit Ctrl-A, Access will show (and repeating that will hide it again.).

          One tip, a lot of sample databases have initial startup code. The MiniCalendar hides Access, however some are live dbs, that someone posts a portion for sample usage. A lot of times in those cases, there is startup code that fails, since either part has been disabled, or it is looking for a network resource that doesn’t exist. You can bypass any access databases startup routines by holding the shift key down. You can disable the ShiftBypassKey through code, for your own applications (to prevent users from bypassing your startup stuff), but I have yet to see a sample database that had the ShiftBypassKey disabled.

    Viewing 2 reply threads
    Reply To: Problem returning Date from Control? (A2k (9.0.3821) SR-1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: