Adding a date field to db

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rio Liaden
    New Member
    • Sep 2006
    • 25

    #16
    Originally posted by MSeda
    Question
    In your Initial post you said you have multiple lines to enter employee time. On your form do the text boxes on each line link to the same "control source"?
    i.e. do you have a Monday line with a date box with "Control Source" TblDate and the same for Tuesday etc.

    Yes. Each line will enter that day's date, and as I said in the last post, I changed it from tblDay, tblMonth, and tblYear to a calendar on the form. A text box on each of the lines will populate with the date when you click on the calendar date. The problem is, that particular date will populate on each line, and as the date for each new line is inserted, the new, changed date then populates each line, i.e. click on the calendar for Monday, Nov. 6. and that date would be put in the text box on the first line. The next day, Nov. 7 click on the calendar and Nov. 7 would be would be put in the text box on that line and also in the text box for the previous line, replacing Nov. 6.

    Thanks for your help!

    Comment

    • MSeda
      Recognized Expert New Member
      • Sep 2006
      • 159

      #17
      If multiple text boxes on your form have the same control source that would cause what you described. A single form only shows one record at a time therefore regardless of the fact that you have multiple textboxes they are all looking at the same feild and record so when calendar or combos update one they all change. send me a screen shot of the design view of your form with a description of the underlying tables, I may be able to make a suggestion.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32645

        #18
        Originally posted by Rio Liaden
        Is that because I'm being a pain? My life's work and I'm good at my job! Anyway, ...
        I like to see someone with pride in their accomplishments ;)
        If the WorkDate control is a TextBox, then I'm confused.
        I'm not a great expert on working with forms and all that, but I would have expected that to work on the current record only (as obviously you did).

        BTW if your code is exactly as posted, then you have some empty event procedures in there. They can safely be deleted. They are entered automatically by Access as a type of template for code when you select them. Sometimes you just select them to look and don't want to add code. In that case the empty shells are redundant.

        Sorry I couldn't be more help.

        Comment

        • Rio Liaden
          New Member
          • Sep 2006
          • 25

          #19
          Originally posted by MSeda
          If multiple text boxes on your form have the same control source that would cause what you described. A single form only shows one record at a time therefore regardless of the fact that you have multiple textboxes they are all looking at the same feild and record so when calendar or combos update one they all change. send me a screen shot of the design view of your form with a description of the underlying tables, I may be able to make a suggestion.
          Here it is...[IMG]C:\Documents and Settings\blee\D esktop\Screen shot.doc[/IMG]

          Comment

          • MSeda
            Recognized Expert New Member
            • Sep 2006
            • 159

            #20
            That didn't display you can e-mail if you like.

            Comment

            • Rio Liaden
              New Member
              • Sep 2006
              • 25

              #21
              Originally posted by MSeda
              That didn't display you can e-mail if you like.

              Hopefully you have received the screen shots. Ignore the comment box that says the calendar is informational. I want it to be functional.

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32645

                #22
                Some links don't work when first posted (many web links for instance).
                I get around it by editing post immediately and saving with the 'Automatically parse links in text' option set.

                Comment

                • Rio Liaden
                  New Member
                  • Sep 2006
                  • 25

                  #23
                  Originally posted by NeoPa
                  Some links don't work when first posted (many web links for instance).
                  I get around it by editing post immediately and saving with the 'Automatically parse links in text' option set.

                  Thanks! I actually tried that but my shots were too large even after I zipped them. Is that common?

                  Comment

                  • MSeda
                    Recognized Expert New Member
                    • Sep 2006
                    • 159

                    #24
                    Just to describe the form for others:
                    the form view is set to continuous forms so a user can enter multiple records into the time sheet. there is a calendar control in the form footer whose on click sets the work_date textbox in the detail section.

                    My previous comment of having multiple textboxes applied to a single form view. you have a continuous form view. The work_date text box is currently unbound.
                    so when calendar changes the date all work_dates in the detail section change since there is nothing to hold the value.
                    Once you set work_dates "control source" property to the field you want to store the date in, this will stop and the calendar will only reset the current records date.

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32645

                      #25
                      I thought I saw star quality.
                      MSeda - a credit to these forums.

                      Comment

                      • Rio Liaden
                        New Member
                        • Sep 2006
                        • 25

                        #26
                        Originally posted by MSeda
                        Just to describe the form for others:
                        the form view is set to continuous forms so a user can enter multiple records into the time sheet. there is a calendar control in the form footer whose on click sets the work_date textbox in the detail section.

                        My previous comment of having multiple textboxes applied to a single form view. you have a continuous form view. The work_date text box is currently unbound.
                        so when calendar changes the date all work_dates in the detail section change since there is nothing to hold the value.
                        Once you set work_dates "control source" property to the field you want to store the date in, this will stop and the calendar will only reset the current records date.

                        What is the WorkDate control source? I sort of understand, but I need to bind the text box to the control source and I'm not sure what the control source is. It is the calendar but I'm a bit confused.

                        Comment

                        • MSeda
                          Recognized Expert New Member
                          • Sep 2006
                          • 159

                          #27
                          The Control Source is the field in the underlying table where the data is stored.
                          i.e. when you have a combo box named Task ID on your form when a user selects a task it saves there selection in the task ID column of the underlying table. if you open the properties menu for the task ID combo box on the data tab you will see "control source" says "task ID".
                          The Work Date text box on the form you sent me reads "Unbound" meaning it is not set to save the data anywhere. open the properties window for work date and set the control source to the appropriate feild in your table. you will find Control Source has a drop down list of all feilds in the source table or query. If you don't already have a date feild in the table you need to create one with a date/time data type before you can do this.

                          Comment

                          • Rio Liaden
                            New Member
                            • Sep 2006
                            • 25

                            #28
                            Originally posted by MSeda
                            The Control Source is the field in the underlying table where the data is stored.
                            i.e. when you have a combo box named Task ID on your form when a user selects a task it saves there selection in the task ID column of the underlying table. if you open the properties menu for the task ID combo box on the data tab you will see "control source" says "task ID".
                            The Work Date text box on the form you sent me reads "Unbound" meaning it is not set to save the data anywhere. open the properties window for work date and set the control source to the appropriate feild in your table. you will find Control Source has a drop down list of all feilds in the source table or query. If you don't already have a date feild in the table you need to create one with a date/time data type before you can do this.

                            You know, MSeda, you are a credit to this forum. I needed a memory jog and you gave it to me. I have been so frustrated with other aspects of my job that I could not think. I have built many databases from scratch but unfortunately, I inherited this one. I did not go back to basics and therefore, sounded like an idiot on this forum. Forgive me. I did as you instructed, put in a WorkDate field (duh!) bound it and my form is doing exactly what I needed.

                            Thank you so much again and when my head settles back on my shoulders, believe it or not, I may one day be able to help you! Definetely not as much as you helped me, but hopefully a fraction!

                            Rio

                            Comment

                            Working...