• Calendar Control as a Text Box Control Source (2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Calendar Control as a Text Box Control Source (2000)

    Author
    Topic
    #404507

    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?

    Viewing 1 reply thread
    Author
    Replies
    • #823375

      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.

      • #823602

        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?

        • #823604

          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.

        • #823605

          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.

        • #823610

          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

          • #823626

            Ciao Hans, thank you, perfect as usual. smile
            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?

            • #823640

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

            • #823650

              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?

            • #823670

              Hi Giorgio,

              Set the Control Source of Energia to

              =[Lettur]-DLookUp("Lettur","G1Dez","Giorno=#" & Format([Giorno]-1,"mm/dd/yyyy") & "#")
              

              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)

            • #824467

              thankyouHans,
              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?

            • #824468

              thankyouHans,
              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?

            • #824469

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

              If you use the method from post 369675, 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.

            • #824480

              I’ve inserted (see attachment)a text box bound to CGior in the subform, but it gives me the “#Name?” error.

            • #824488

              Giorgio,

              There was a small typo in my reply, but you have set the control source of the text box in the subform to an expression =[CGior]. It should be the field name Giorno (not CGiorno as I originally wrote.)

            • #824491

              Ok, I’ve set the control source of the text box in the subform to the GIORNO field(see attachment) but when, e.g., I select January 1st, 2004 on the calendar, the date appears in the the GIORNO text box but it’s not added to the subform record source.

            • #824509

              I clicked on yesterday (May 6, 2004) in the calendar and entered some numbers in the subform, then clicked on today (May 7, 2004) and entered some numbers. The date was automatically filled in, and the table now contains records for these two days.

            • #824515

              Oh, I thought even without entering data in the other fields, selecting a new date in the calendar would have created a new record if afterwards you selected another date in the calendar.

            • #824517

              No, a record is only created when you start entering data into it.

            • #825207

              I put “<[pot_max]" as Validation Rule for the PMedia text box on the subform(see attachment) but it doesn't work.
              Is there a way to make the Validation Rule for a text box work even if you don't enter data directly in the text box?

            • #825244

              No, there isn’t. You will have to check the value in the Before Update event of the form. If PMedia is too large, set Cancel = True en set focus to one of the controls contributing to the value of PMedia.

            • #825413

              I’ve tried that in the BeforeUpdate event for the MG1Dezx subform(see attachment) but it doesn’t seem to work because the “a” variable doesn’t get updated.

            • #825432

              Seemed to work ok for me when I changed some values.

              But as an alternative, you could set validation rules for Ore_marc and Pot_max; you already have one for Lettur. As far as I can see, these are the fields that determine the value of PMedia.

            • #825466

              Once again I’m sorry Hans, the Before Update event does work, I was thrown by the fact the a variable equaled 0.

            • #825467

              Once again I’m sorry Hans, the Before Update event does work, I was thrown by the fact the a variable equaled 0.

            • #826313

              I can’t seem to make the validation rule for the POT_MAX text box in any of the three subforms of the DEZZO startup form work.

              <=DLookUp("potkW","idro_pot","d_cent=dezzo and n_grup=2")

              Do you think there's anything wrong with the syntax?

            • #826325

              Your table name is IDR_POT and not IDRO_POT
              The field d_cent and n_grup are strings so the data should surround by quotes.
              Use

              <=DLookUp("potkW";"idr_pot";"d_cent= 'dezzo' and n_grup= '1'")
            • #826342

              Bonjour Mon Ami!
              Francois, thank goodness you’re around to relieve Hans from some of the burden I’m placing upon him. cooked
              When I try to input your modification in the validation rule box I get the following:

            • #826348

              Sorry, I copy and past and come up with semicolons instead of commas due to my international settings.
              It should be :

              <=DLookUp("potkW","idr_pot","d_cent= 'dezzo' and n_grup= '1'")
            • #826404

              Let me take this opportunity…(he he he he) yep
              …to ask you how I can get rid of the error messages that appear on startup in the PMEDIA, REND and COEFF text boxes in any of the subforms.(please see attachment)
              I know this is due to the lack of any record corresponding to the date selected on the calendar because the calendar is set to show today’s date when the form opens.

            • #826414

              If you change the control source of the energia textbox from :
              =IIf(IsNull([lettur]),””,([Lettur]-DLookUp(“Lettur”,”G1Dez”,”Giorno=#” & Format([Giorno]-1,”mm/dd/yyyy”) & “#”))*DLookUp(“K_CONT”,”DezG1K”))
              to :
              =IIf(IsNull([lettur]),,([Lettur]-DLookUp(“Lettur”,”G1Dez”,”Giorno=#” & Format([Giorno]-1,”mm/dd/yyyy”) & “#”))*DLookUp(“K_CONT”,”DezG1K”))
              you get Energia ? in the textboxes.
              Is it that what you want ?
              This time I change the semicolons in commas blush

            • #826417

              Isn’t it possible to leave the text boxes in question blank(like you see happening to all the others except the SALTO text box that has a default value) when no underlying record corresponds to the date shown by the calendar?

            • #826431

              To do this, you have to replace the multi IIF statements from the textbox control source by a function you write yourself.
              In the attached file, I have done it for Potenza Media in the subform G1Dez.
              I replace the controlsource by =PotenzaMedia() and in the code of the form I add a PotenzaMedia() function.
              In this function I add a condition to check the len of Enregia and if this len is 0 then I set PotenzaMedia Function to “”.
              Do the same for the other 2 textboxes in the form and for the 3 textboxes in the 2 other forms.
              If you need help post again, but look at my code and try it yourself first.

            • #827683

              Thank you so much Francois,
              I’ve used your idea by creating those functions in a module (Module1, please see attachment) and they all work well except for the function you see below which I set as control source for either of the three subforms’ OREF text box.

              Function Fermi(table As String, gio, marc, lett)
              Dim a
              a = 24 – DLookup(“ora_let”, “& table &”, “Giorno=#” & Format(gio – 1, “mm/dd/yyyy”)) + lett
              Fermi = a – marc
              If Fermi < 0 Then MsgBox "Attenzione! Ore di marcia non possono essere superiori alle ore di lettura."
              End Function

              Which gives me the error message, "The Microsoft Jet database engine cannot find the input table or query '=fermi(g1dez)'. Make sure it exists and that its name is spelled correctly."
              What's wrong?

            • #827917

              Your record source of the form is not correct. The following I got from Access 2000 help:

              The RecordSource property setting can be a table name, a query name, or an SQL statement.

              I also notice you have a function name the same as a table name.

            • #827933

              Hi Pat, nice to hear from you again. hello
              But…each of the three subforms has a table as record source. confused
              And I’ve changed the name of the function(see attachment) but now the OREF text box in each of the three subforms gives me the #Name? error.

            • #827942

              When you define a source of your function, the first argument is a string value, therefore I would suggest you change it to:

              =fermo(“g3dez”,[giorno],[ore_marc],[ora_let])

              Notice the table name in quotes.

              Also you will need to change a line in your function to delete the quotes around the table name, so change the line from:

              a = 24 – DLookup(“ora_let”, “& table &”, “Giorno=#” & Format(gio – 1, “mm/dd/yyyy”)) + lett

              to:

              a = 24 – DLookup(“ora_let”, table, “Giorno=#” & Format(gio – 1, “mm/dd/yyyy”)) + lett

            • #827946

              Thanks Pat,
              I’ve done everything you said and now when I open the mdb file(please see attachment) I get the message: “Run-time error ‘3075’:
              Syntax error in date in query expression ‘Giorno=#’.”
              And the VBA code stops at this line in the FERMO function:
              a = 24 – DLookup(“ora_let”, table, “Giorno=#” & Format(gio – 1, “mm/dd/yyyy”)) + lett

            • #827954

              I think you will find that the 3 other arguments are Null when you first call this function, I have made it work by:

              Function Fermo(table As String, gio, marc, lett)
              Dim a
              If IsNull(gio) Or IsNull(marc) Or IsNull(lett) Then
              Fermo = 0
              Else
              a = 24 – DLookup(“ora_let”, table, “Giorno=#” & Format(gio – 1, “mm/dd/yyyy”)) + lett
              Fermo = a – marc
              If Fermo < 0 Then MsgBox "Attenzione! Ore di marcia non possono essere superiori alle ore di lettura."
              End If
              End Function

            • #827964

              Thanks again Pat,
              Problem is if you select a date on the calendar(say, e.g., October 10, 2003) which corresponds to a record in either subform record source, I still get the message: “Run-time error ‘3075’:
              Syntax error in date in query expression ‘Giorno=#’.”
              And the VBA code stops at this line in the FERMO function:
              a = 24 – DLookup(“ora_let”, table, “Giorno=#” & Format(gio – 1, “mm/dd/yyyy”)) + lett

            • #827966

              You omitted a trailing # sign in your command.
              try
              a = 24 – DLookup(“ora_let”, table, “Giorno=#” & Format(gio – 1, “mm/dd/yyyy”) & “#”) + lett

            • #827970

              Perfect! Thank you so much Pat for helping me along the way to the solution. bravo

            • #827971

              Perfect! Thank you so much Pat for helping me along the way to the solution. bravo

            • #828903

              Still using the same concept I’ve created yet another function(TipiFermo in the Module1 module, please see attachment) for the CODF combo box in the subform but this time I cannot call it from the CODF combobox’s control source box in the property sheet because it’s already pointing to the CODF field in the FERMI table so I’ve tried calling the function from the After Update event of the CODF combo box but it doesn’t work. What that function should do is to alert the user that if the value of the OREF text box is greater than zero, the user should pick a value in the CODF combo box drop-down list.

            • #829090

              The controls in the previous posts were calculated controls; the CODF combo box is different, it is bound to a field. Since you want to impose a condition based on two fields, I think you should add code to the Before Update event of the subform, and set Cancel = True if oref > 0 and codf is null:

              Private Sub Form_BeforeUpdate(Cancel As Integer)

              ‘ existing code

              If Me.OREF > 0 And IsNull(Me.CODF) Then
              MsgBox “Attenzione. Please select an item from the dropdown list.”, vbExclamation
              Me.CODF.SetFocus
              Cancel = True
              End If
              End Sub

            • #829164

              The little problem with the Before Update event for a form is that if the condition is true then the whole record is aborted. Isn’t there a way to avoid having to retype all the record if the condition is true?

            • #829174

              Unless you include Me.Undo in the code, the only effect of Cancel = True is that the record is not saved, but the user can still modify the values entered.

            • #829308

              thankyouHans,
              The ENERGIA text box in the subform of the attached mdb uses the Dlookup function to find the previous-day value for the LETTUR text box so I thought of using the same function to set the default value for the LETTUR text box on the same subform(see attachment) but as soon as I select a date on the calendar I get a type mismatch error.

            • #829340

              There is some kind of circular calculation going on if you are on a new record, probably because PMedia etc. are based on Energia, Energia is based on Lettur, and Lettur doesn’t have a value yet. I think it’s getting too complicated to solve easily.

              I will lock this thread now, for it has drifted away from the original question and has become very long. Please feel free to start a new thread.

            • #829341

              There is some kind of circular calculation going on if you are on a new record, probably because PMedia etc. are based on Energia, Energia is based on Lettur, and Lettur doesn’t have a value yet. I think it’s getting too complicated to solve easily.

              I will lock this thread now, for it has drifted away from the original question and has become very long. Please feel free to start a new thread.

            • #829309

              thankyouHans,
              The ENERGIA text box in the subform of the attached mdb uses the Dlookup function to find the previous-day value for the LETTUR text box so I thought of using the same function to set the default value for the LETTUR text box on the same subform(see attachment) but as soon as I select a date on the calendar I get a type mismatch error.

            • #829175

              Unless you include Me.Undo in the code, the only effect of Cancel = True is that the record is not saved, but the user can still modify the values entered.

            • #829165

              The little problem with the Before Update event for a form is that if the condition is true then the whole record is aborted. Isn’t there a way to avoid having to retype all the record if the condition is true?

            • #829091

              The controls in the previous posts were calculated controls; the CODF combo box is different, it is bound to a field. Since you want to impose a condition based on two fields, I think you should add code to the Before Update event of the subform, and set Cancel = True if oref > 0 and codf is null:

              Private Sub Form_BeforeUpdate(Cancel As Integer)

              ‘ existing code

              If Me.OREF > 0 And IsNull(Me.CODF) Then
              MsgBox “Attenzione. Please select an item from the dropdown list.”, vbExclamation
              Me.CODF.SetFocus
              Cancel = True
              End If
              End Sub

            • #828904

              Still using the same concept I’ve created yet another function(TipiFermo in the Module1 module, please see attachment) for the CODF combo box in the subform but this time I cannot call it from the CODF combobox’s control source box in the property sheet because it’s already pointing to the CODF field in the FERMI table so I’ve tried calling the function from the After Update event of the CODF combo box but it doesn’t work. What that function should do is to alert the user that if the value of the OREF text box is greater than zero, the user should pick a value in the CODF combo box drop-down list.

            • #827967

              You omitted a trailing # sign in your command.
              try
              a = 24 – DLookup(“ora_let”, table, “Giorno=#” & Format(gio – 1, “mm/dd/yyyy”) & “#”) + lett

            • #827965

              Thanks again Pat,
              Problem is if you select a date on the calendar(say, e.g., October 10, 2003) which corresponds to a record in either subform record source, I still get the message: “Run-time error ‘3075’:
              Syntax error in date in query expression ‘Giorno=#’.”
              And the VBA code stops at this line in the FERMO function:
              a = 24 – DLookup(“ora_let”, table, “Giorno=#” & Format(gio – 1, “mm/dd/yyyy”)) + lett

            • #827955

              I think you will find that the 3 other arguments are Null when you first call this function, I have made it work by:

              Function Fermo(table As String, gio, marc, lett)
              Dim a
              If IsNull(gio) Or IsNull(marc) Or IsNull(lett) Then
              Fermo = 0
              Else
              a = 24 – DLookup(“ora_let”, table, “Giorno=#” & Format(gio – 1, “mm/dd/yyyy”)) + lett
              Fermo = a – marc
              If Fermo < 0 Then MsgBox "Attenzione! Ore di marcia non possono essere superiori alle ore di lettura."
              End If
              End Function

            • #827947

              Thanks Pat,
              I’ve done everything you said and now when I open the mdb file(please see attachment) I get the message: “Run-time error ‘3075’:
              Syntax error in date in query expression ‘Giorno=#’.”
              And the VBA code stops at this line in the FERMO function:
              a = 24 – DLookup(“ora_let”, table, “Giorno=#” & Format(gio – 1, “mm/dd/yyyy”)) + lett

            • #827943

              When you define a source of your function, the first argument is a string value, therefore I would suggest you change it to:

              =fermo(“g3dez”,[giorno],[ore_marc],[ora_let])

              Notice the table name in quotes.

              Also you will need to change a line in your function to delete the quotes around the table name, so change the line from:

              a = 24 – DLookup(“ora_let”, “& table &”, “Giorno=#” & Format(gio – 1, “mm/dd/yyyy”)) + lett

              to:

              a = 24 – DLookup(“ora_let”, table, “Giorno=#” & Format(gio – 1, “mm/dd/yyyy”)) + lett

            • #827934

              Hi Pat, nice to hear from you again. hello
              But…each of the three subforms has a table as record source. confused
              And I’ve changed the name of the function(see attachment) but now the OREF text box in each of the three subforms gives me the #Name? error.

            • #827918

              Your record source of the form is not correct. The following I got from Access 2000 help:

              The RecordSource property setting can be a table name, a query name, or an SQL statement.

              I also notice you have a function name the same as a table name.

            • #827684

              Thank you so much Francois,
              I’ve used your idea by creating those functions in a module (Module1, please see attachment) and they all work well except for the function you see below which I set as control source for either of the three subforms’ OREF text box.

              Function Fermi(table As String, gio, marc, lett)
              Dim a
              a = 24 – DLookup(“ora_let”, “& table &”, “Giorno=#” & Format(gio – 1, “mm/dd/yyyy”)) + lett
              Fermi = a – marc
              If Fermi < 0 Then MsgBox "Attenzione! Ore di marcia non possono essere superiori alle ore di lettura."
              End Function

              Which gives me the error message, "The Microsoft Jet database engine cannot find the input table or query '=fermi(g1dez)'. Make sure it exists and that its name is spelled correctly."
              What's wrong?

            • #826432

              To do this, you have to replace the multi IIF statements from the textbox control source by a function you write yourself.
              In the attached file, I have done it for Potenza Media in the subform G1Dez.
              I replace the controlsource by =PotenzaMedia() and in the code of the form I add a PotenzaMedia() function.
              In this function I add a condition to check the len of Enregia and if this len is 0 then I set PotenzaMedia Function to “”.
              Do the same for the other 2 textboxes in the form and for the 3 textboxes in the 2 other forms.
              If you need help post again, but look at my code and try it yourself first.

            • #826418

              Isn’t it possible to leave the text boxes in question blank(like you see happening to all the others except the SALTO text box that has a default value) when no underlying record corresponds to the date shown by the calendar?

            • #826349

              Sorry, I copy and past and come up with semicolons instead of commas due to my international settings.
              It should be :

              <=DLookUp("potkW","idr_pot","d_cent= 'dezzo' and n_grup= '1'")
            • #826343

              Bonjour Mon Ami!
              Francois, thank goodness you’re around to relieve Hans from some of the burden I’m placing upon him. cooked
              When I try to input your modification in the validation rule box I get the following:

            • #826352

              I take it back. IT WORKS. bash

            • #826353

              I take it back. IT WORKS. bash

            • #826326

              Your table name is IDR_POT and not IDRO_POT
              The field d_cent and n_grup are strings so the data should surround by quotes.
              Use

              <=DLookUp("potkW";"idr_pot";"d_cent= 'dezzo' and n_grup= '1'")
            • #826314

              I can’t seem to make the validation rule for the POT_MAX text box in any of the three subforms of the DEZZO startup form work.

              <=DLookUp("potkW","idro_pot","d_cent=dezzo and n_grup=2")

              Do you think there's anything wrong with the syntax?

            • #825433

              Seemed to work ok for me when I changed some values.

              But as an alternative, you could set validation rules for Ore_marc and Pot_max; you already have one for Lettur. As far as I can see, these are the fields that determine the value of PMedia.

            • #825414

              I’ve tried that in the BeforeUpdate event for the MG1Dezx subform(see attachment) but it doesn’t seem to work because the “a” variable doesn’t get updated.

            • #825245

              No, there isn’t. You will have to check the value in the Before Update event of the form. If PMedia is too large, set Cancel = True en set focus to one of the controls contributing to the value of PMedia.

            • #825208

              I put “<[pot_max]" as Validation Rule for the PMedia text box on the subform(see attachment) but it doesn't work.
              Is there a way to make the Validation Rule for a text box work even if you don't enter data directly in the text box?

            • #824518

              No, a record is only created when you start entering data into it.

            • #824516

              Oh, I thought even without entering data in the other fields, selecting a new date in the calendar would have created a new record if afterwards you selected another date in the calendar.

            • #824510

              I clicked on yesterday (May 6, 2004) in the calendar and entered some numbers in the subform, then clicked on today (May 7, 2004) and entered some numbers. The date was automatically filled in, and the table now contains records for these two days.

            • #824492

              Ok, I’ve set the control source of the text box in the subform to the GIORNO field(see attachment) but when, e.g., I select January 1st, 2004 on the calendar, the date appears in the the GIORNO text box but it’s not added to the subform record source.

            • #824489

              Giorgio,

              There was a small typo in my reply, but you have set the control source of the text box in the subform to an expression =[CGior]. It should be the field name Giorno (not CGiorno as I originally wrote.)

            • #824481

              I’ve inserted (see attachment)a text box bound to CGior in the subform, but it gives me the “#Name?” error.

            • #824470

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

              If you use the method from post 369675, 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.

            • #823671

              Hi Giorgio,

              Set the Control Source of Energia to

              =[Lettur]-DLookUp("Lettur","G1Dez","Giorno=#" & Format([Giorno]-1,"mm/dd/yyyy") & "#")
              

              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)

            • #823651

              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?

            • #823641

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

          • #823627

            Ciao Hans, thank you, perfect as usual. smile
            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?

          • #823630

            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.

            • #823636

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

            • #823644

              Oopsie! Sorry Hans. I forgot that blush.

            • #823645

              Oopsie! Sorry Hans. I forgot that blush.

            • #823637

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

          • #823631

            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.

        • #823611

          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

      • #823603

        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?

    • #823376

      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.

    Viewing 1 reply thread
    Reply To: Calendar Control as a Text Box Control Source (2000)

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

    Your information: