Textbox format

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

    Textbox format

    Dear all,

    in a form, I have a subform which shows some information from a table.

    in this subform, I have 3 fields, say for example, field1, field2, field3, which are in fact representatives of three fields in the table itself.

    in the subform, I want to have a field that shows field1/field2/field3

    So I created a new unbound field, and in the record source, I wrote: =field1 + "/" + field2 + "/" + field3


    It is working, but it acts so slow. all the other fields are shown in the blink of an eye, but this field takes about 0.5 - 1 second to appear.

    is there another way to do this faster?
  • Echidna
    New Member
    • Jan 2008
    • 53

    #2
    Hi,

    one way would be to write a query having the Field1, Field 2 and Field3, then a fourth expression field which holds the new source as an expression which would equal the source you have for the Unbound control.

    This should display a lot faster.

    Hope this Helps

    Leon

    Comment

    • Alireza355
      New Member
      • Feb 2009
      • 86

      #3
      What??????????? ??

      I am not so good in English. Can you please explain a little bit more?????? I don't get the image.

      Comment

      • Echidna
        New Member
        • Jan 2008
        • 53

        #4
        Apologies for being ambiguous.

        From the Table you are using to populate the Subform, you want to write a new query.

        Include all of the fields you require for this subform.
        also, write a new "unbound" field (this is an expression)
        call it something like myfield123

        in this new field you place the source for the unbound control you have on the subform

        [Field1] + "/" + [Field2] + "/" + [Field3]

        save this new query and change the recordsource of the subform to the query you have just written.

        also change the name of the control to the name of the field containing the expression.

        This will replace the current recordsource with the recordsource you have been using, with the addition of the new field "myfield123 " (or whatever you choose to name it) which will show the Contents of your example fields

        Hope this helps


        Leon

        Comment

        • mshmyob
          Recognized Expert Contributor
          • Jan 2008
          • 903

          #5
          There are a few ways but could you please try the following before I give you a different solution.

          If you are trying to divide your fields why not just put the following in your control source

          =Field1/Field2/Field3

          You do not need the "+" signs or all the quotes.

          cheers,

          Originally posted by Alireza355
          Dear all,

          in a form, I have a subform which shows some information from a table.

          in this subform, I have 3 fields, say for example, field1, field2, field3, which are in fact representatives of three fields in the table itself.

          in the subform, I want to have a field that shows field1/field2/field3

          So I created a new unbound field, and in the record source, I wrote: =field1 + "/" + field2 + "/" + field3


          It is working, but it acts so slow. all the other fields are shown in the blink of an eye, but this field takes about 0.5 - 1 second to appear.

          is there another way to do this faster?

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32663

            #6
            Originally posted by mshmyob
            If you are trying to divide your fields why not just put the following in your control source

            =Field1/Field2/Field3

            You do not need the "+" signs or all the quotes.
            I tried that and got #Error for may pains. I use Access 2003.

            @Ali,
            Is your form used for updates?
            If so, then your original version may be all you can use. The query method is a good idea just to show the data, but it will stop the recordset being updatable.

            PS. Don't give up yet though. Mshmyob says there may be other approaches to try.

            Comment

            • mshmyob
              Recognized Expert Contributor
              • Jan 2008
              • 903

              #7
              hmmm. Works fine in Access 2007.

              Maybe replace the + signs with & then. If that doesn't work I will give you an other solution.

              cheers,

              Originally posted by NeoPa
              I tried that and got #Error for may pains. I use Access 2003.

              @Ali,
              Is your form used for updates?
              If so, then your original version may be all you can use. The query method is a good idea just to show the data, but it will stop the recordset being updatable.

              PS. Don't give up yet though. Mshmyob says there may be other approaches to try.

              Comment

              • missinglinq
                Recognized Expert Specialist
                • Nov 2006
                • 3533

                #8
                The simply query won't make the subform read-only if it's based on a single table, will it, NeoPa? Then a calculated field of:

                myfield: [field1] & "/" & [field2] & "/" & [field3]


                Linq ;0)>

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32663

                  #9
                  No Linq. You're right. It doesn't. My bad.

                  Access simply locks that particular field.

                  It would seem that is possibly an excellent solution then (see Leon's post #4).

                  Comment

                  • Echidna
                    New Member
                    • Jan 2008
                    • 53

                    #10
                    Sorry, I seem to have posted be a mixture of t-SQL and MS Access :)

                    should have realised the ampersand... oops

                    Cheers

                    Leon

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32663

                      #11
                      That actually shouldn't be a problem Leon. See Using "&" and "+" in WHERE Clause.

                      It may be that & is preferred as you probably wouldn't want a Null value perpetuated, but it should work generally.

                      Comment

                      • Echidna
                        New Member
                        • Jan 2008
                        • 53

                        #12
                        Cool,

                        You learn something new every day :)

                        Cheers

                        Leon

                        Comment

                        • missinglinq
                          Recognized Expert Specialist
                          • Nov 2006
                          • 3533

                          #13
                          Originally posted by Echidna
                          You learn something new every day :)
                          That's the beauty of MS Access!

                          Linq ;0>

                          Comment

                          • Alireza355
                            New Member
                            • Feb 2009
                            • 86

                            #14
                            I am not trying to divide.

                            I am not tring to divide. I just want to have a slash (/) sign between them:

                            alfa
                            beta
                            charlie

                            alfa/beta/charlie

                            :(

                            Comment

                            • Echidna
                              New Member
                              • Jan 2008
                              • 53

                              #15
                              I don't understand,

                              I have tested the [field1] & "/" & [Field2] & "/" & [Field3] method within a select Query (see below)

                              Code:
                              SELECT Table1.ID, Table1.Field1, Table1.Field2, Table1.Field3, [Field1] & "/" & [Field2] & "/" & [Field3] AS myfield123
                              FROM Table1;
                              the output generates what you are suggesting

                              Cheers

                              Leon

                              Comment

                              Working...