Problem with Databound textboxes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JFKJr
    New Member
    • Jul 2008
    • 126

    Problem with Databound textboxes

    Hello everyone,

    I created an Access VBA form, which contains a date textbox and a calendar image. The textbox is bounded to "Date" field of "UserProfil e" Table.

    Whenever a user clicks the calendar image, a popup calendar will be opened and the user can choose date to enter it in the focused textbox.

    But, I want to enter the chosen date in all the bounded date textboxes present in the form instead of only in the focused textbox.

    Please kindly let me know how to solve this issue.

    Thanks in advance.
  • Kevin Wilcox
    New Member
    • Sep 2007
    • 68

    #2
    Hi

    How about using the 'on updated' event of the calendar control? i.e.

    Code:
    Private Sub Calendar_Updated(Code As Integer)
    text box 1 = me.calendar
    text box 2 = me.calendar
    'and so on, using the correct names for your controls
    End Sub
    Kevin

    Comment

    • FishVal
      Recognized Expert Specialist
      • Jun 2007
      • 2656

      #3
      Hello.

      Take look at Forms Interaction howto.

      Regards,
      Fish

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        I think we need to clarify one point before we get off on the wrong tangent here! Is Kevin correct in assuming that by

        Originally posted by JFKJr
        I want to enter the chosen date in all the bounded date textboxes present in the form instead of only in the focused textbox.
        you mean that you have a number of different textboxes in the current ***record*** all of which you want to set to this selected date?

        Or do you mean that you want the selected date to populate the same textbox on all of the records in your form?

        Linq ;0)<

        Comment

        • JFKJr
          New Member
          • Jul 2008
          • 126

          #5
          Hello missinglinq,

          Thanks for the reply.

          I want the selected date to populate in the same textbox on all of the records in my form.

          Please let me know how to solve this issue.

          Thanks a million.

          Comment

          • mandanarchi
            New Member
            • Sep 2008
            • 90

            #6
            Code:
            DoCmd.SetWarnings False
            Dim SQL As String
            SQL = "UPDATE userProfile" & _
                      "SET userProfile.Date= '" & me.calendar & "'
            'MsgBox SQL
            DoCmd.RunSQL SQL
            DoCmd.SetWarnings True
            In theory that should update all instances of the 'Date' field from the table 'UserProfile' to the value selected on the selected forms calendar control (named 'calendar').
            The MsgBox is a debug thing I do; comment out the RunSQL line and uncomment MsgBox to get a popup box containing the SQL.
            PLEASE copy or backup the table before running this as I haven't tested it, I've just copied and modified.
            Also if you need it to be only certain ones add a WHERE at the end.

            Oh, and comment out the first line "SetWarning s False", and you'll get a message saying how many records will be updated and asking if you want to continue. It's a good idea to do this to make sure you're getting the number you think you should be.

            Comment

            Working...