Switching values between tab pages.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AccessBeetle
    New Member
    • Jul 2009
    • 111

    Switching values between tab pages.

    I have a bound form which has tab control with 10 pages. I want to switch date values between page 1 and page 3.
    For example on Page 1 there is a textbox called Start Date and End Date
    On Page 3 there is a textbox called Final Start Date and Final End Date.
    On Page 1 Start Date txtbox is locked and should automatically populate value which will be entered on Page 3's Final Start Date.
    I tried to set the default value of Start date but it says "#Name".
    Code:
    Default value=[Forms]![Main Data Entry]![ExtensionFinalStartDate].[Text]
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Hi AccessBeetle. Two problems: the Text property is only available when the textbox concerned has focus, and the default value property is not being correctly set or referred to.

    If you are using VBA to set the default value property you should be able to refer to controls that are on your current form's tabbed pages using the Me shortcut to replace the full reference to forms!formname! controlname.

    The VBA form of setting the default is:

    Code:
    Me.YourStartDate.DefaultValue="'" & Me.ExtensionFinalStartDate & "'"
    Note that the default value is a text property - hence the single quotes on either side.

    If you are not using VBA but just want to refer directly to the other control in the Start Date's Default Value property in design view, you would just set the default value property for the control concerned to:

    Code:
    =[Forms]![Main Data Entry]![ExtensionFinalStartDate]
    The use of the .Text property would explain the error message you got.

    -Stewart

    Comment

    • AccessBeetle
      New Member
      • Jul 2009
      • 111

      #3
      thanks for reply
      I am using second option.
      I tried to put something like this but now it says "#Error" in tha tbox
      Code:
      =[Forms]![Main Data Entry]![ExtensionFinalStartDate].[Text]

      Comment

      • hedges98
        New Member
        • Oct 2009
        • 109

        #4
        Remove the .[Text] bit on the end. Stewart did explain that is why you were getting the error message

        Comment

        • AccessBeetle
          New Member
          • Jul 2009
          • 111

          #5
          Code:
          =[Forms]![Main Data Entry]![ExtensionFinalStartDate]
          My bad!!
          Got it worked
          Thanks!!

          Comment

          Working...