Textbox indent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alireza355
    New Member
    • Feb 2009
    • 86

    Textbox indent

    Dear all,

    Is there a way to have a little indentation in a textbox in a subform in datasheet view?

    I tried this:

    =" " & [MyField]

    in the recordsource, but I keep getting an error.
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    You put it where? A form or report has a Record Source, not a textbox. A textbox has a Control Source but placing such code there will prevent the textbox from being bound to the underlying table/query, if that is needed. Something like this will do the job, but if you do any type of data manipulation, such as searching for strings, you need to keep in mind that the data has the string of spaces in front:

    Code:
    Private Sub MyField_AfterUpdate()
      Me.MyField = "  " & Me.MyField
    End Sub
    Linq ;0)>

    Comment

    • Alireza355
      New Member
      • Feb 2009
      • 86

      #3
      Not yet getting the results needed

      Thank you for your kind reply.

      Sorry about mis-spelling Control Source. I tried your code, but not yet getting the results I need.

      Let me explain a bit more. I have a form with a subform in it. The subform is always displayed in Datasheet View. In one of the columns (fields) I want the text to have a little indentation. I don't think After Update would be appropriate for what I want to do, because the subform is not editable. It just shows some information from a table.

      Thank you so much, and waiting for your support.

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        Alireza355, the people on this forum who answer questions are all volunteering their time.You need to understand that in order to
        • Not waste their time
        • Facilitate their helping you
        you really need to "explain a bit more" in your original post, not after someone has taken the time to answer your question.

        Given this new information, the form your subform is based on will need to have a Query as its Record Source. If it is currently based on a Query, you'll need to add a calculated field, by entering something like this in a new, blank field in the Query Design Grid:

        FormatMyField: " " & [MyField]

        If the form is currently based on a Table, you'll need to create a Query from the Table, including all the fields, then add the calculated field as shown above. You can easily do this using the Query Wizard if need be.

        If the form was originally based directly on the Table, go into Design View for the form and change the Record Source from the Table to your newly created Query.

        In either case, you now need to select the textbox and go into Properties - Data and change the Control Source from MyField to FormatMyField.

        The textbox will now display with your spaces in front of the data.

        Linq ;0)>.

        Comment

        • Alireza355
          New Member
          • Feb 2009
          • 86

          #5
          Thanx a lot

          Yes, Yes, I do undrestand.

          Thank you so much for your kind support.

          Best Regards,
          Alireza355

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32633

            #6
            FYI. The resultant data is a string value and NOT a numeric one.

            Comment

            • missinglinq
              Recognized Expert Specialist
              • Nov 2006
              • 3533

              #7
              That's true, NeoPa, which works out well since the data started out as a string

              Originally posted by Alireza355
              I want the text to have a little indentation.
              ;0)>

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32633

                #8
                That may be true Linq, but there are other ways that could be interpreted in the circumstances.

                I'm very careful what conclusions I jump to - especially when dealing with members whose first language is not English (I don't include you Yanks in that btw ;D).

                Comment

                • Freddyboy
                  New Member
                  • Feb 2022
                  • 2

                  #9
                  Have you tried?

                  Originally posted by NeoPa
                  That may be true Linq, but there are other ways that could be interpreted in the circumstances.

                  I'm very careful what conclusions I jump to - especially when dealing with members whose first language is not English (I don't include you Yanks in that btw ;D).
                  open your subform in a new window. It should show you form view. under 'properties' for the field you want, change the margin to your desired indent.

                  Comment

                  Working...