Page 1 of 4 123 ... LastLast
Results 1 to 15 of 49
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calendar Control as a Text Box Control Source (2000)

    How come if I select a date on the Calendar control on the startup form of the attached mdb, the date selected is not shown right away on the Cdata text box on the same form but I have to click on the Cdata text box to make it show it, since the Calendar control is the text box Control Source?
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calendar Control as a Text Box Control Source (2000)

    You don't have to click in CData specifically; it will be updated as soon as you leave the calendar control. Clicking around in the calendar control is much like typing in a text box: it won't update other controls. Only when you leave the text box in which you typed, or the calendar in which you clicked on dates, will other controls referring to it be updated.

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calendar Control as a Text Box Control Source (2000)

    But then...
    How come once I click on a date on the acxCalBegin control in the frmContracts form in the attached mdb(please open it with the shift key depressed), the date in the txtBeginningDate text box on the same form is automatically shown without the need to leave the calendar control?
    Attached Files Attached Files

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calendar Control as a Text Box Control Source (2000)

    The After Update event of both calendar controls on the form in this database explicitly set the focus to the corresponding text box. As noted before, controls referring to the calendar control will be updated when the calendar loses focus. The effect here is that the text box is updated as soon as you click on a date, but you have to reactivate the calendar to be able to click another date.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calendar Control as a Text Box Control Source (2000)

    If you want the text box to update immediately, do it like this:

    - Clear the Control Source of the text box (yes, I mean it!)
    - Create an On Click event procedure for the calendar (the On Click event is not listed in the Properties window, but it does exist):

    Private Sub CGior_Click()
    Me.CData = Me.CGior.Value
    End Sub

  6. #6
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calendar Control as a Text Box Control Source (2000)

    Ciao Hans, thank you, perfect as usual. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>
    How would you go about calculating the difference between the value of the Lettur field in the MG1Dezx subform for the date selected in the calendar control and the same value for the day before and putting the result in the Energia text box in the same subform?
    Attached Files Attached Files

  7. #7
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calendar Control as a Text Box Control Source (2000)

    Actually Hans, on my pc only the option of setting the focus to the corresponding text box through the After Update event of the calendar control works; if I use
    Private Sub CGior_Click()
    Me.CData = Me.CGior.Value
    End Sub

    I get the attached error message when I select a day on the calendar.
    Attached Images Attached Images

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calendar Control as a Text Box Control Source (2000)

    You MUST clear (delete) the control source of CData (as I mentioned in my previous reply).

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calendar Control as a Text Box Control Source (2000)

    Sorry, I don't understand this question. Could you try again?

  10. #10
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calendar Control as a Text Box Control Source (2000)

    Oopsie! Sorry Hans. I forgot that <img src=/S/blush.gif border=0 alt=blush width=15 height=15>.

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calendar Control as a Text Box Control Source (2000)

    Hi Giorgio,

    Set the Control Source of Energia to
    <pre>=[Lettur]-DLookUp("Lettur","G1Dez","Giorno=#" & Format([Giorno]-1,"mm/dd/yyyy") & "#")
    </pre>

    This will display a blank on the first date (1/1/2003) since there are no data for the previous day, and it will display #Error if you select a date outside the available range (for example in 2002 or 2004)

  12. #12
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calendar Control as a Text Box Control Source (2000)

    Let's suppose that, on the startup form, I select the May 17, 2003 date on the calendar, then a value(9659.33) is displayed on the LETTUR textbox in the subform.
    How can I display, in the Energia text box in the same subform, the value which is the difference between 9659.33 and the value for the day before(9655.39)? So, generalizing, how would you go about calculating the difference between the value of the Lettur field in the MG1Dezx subform for the date selected in the calendar control and the same value for the day before and putting the result in the Energia text box in the same subform?

  13. #13
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calendar Control as a Text Box Control Source (2000)

    <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>Hans,
    Since MG1Dezx is a subform of MG1Dez, I thought selecting a date in the calendar which is not present in the subform record source would automatically add it to it but it doesn't; how can I achieve that?

  14. #14
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calendar Control as a Text Box Control Source (2000)

    I've inserted (see attachment)a text box bound to CGior in the subform, but it gives me the "#Name?" error.
    Attached Files Attached Files

  15. #15
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calendar Control as a Text Box Control Source (2000)

    Edited by HansV to correct typo: Giorno instead of CGiorno.

    If you use the method from <post#=369675>post 369675</post#>, the value of Giorno in the subform will be filled in automatically with the date from CData. But you don't have a text box bound to Giorno in the subform, so you don't see it.

Page 1 of 4 123 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •