Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2004
    Posts
    75

    Unanswered: text box alignment

    Bottom line up front: Does anyone know how to force text alignment?

    More info:
    I have a text box on a form that concatenates several fields (let's say text1, text2, and text3).... Not all of those fields always have values. If text2 is null, text 3 will be null, etc. The text box that this string goes into has a restricted size (certain height and width), so if it is of a certain length, the text will wrap to the second line. Sometimes the string is one line, sometimes it is two. The text box automatically does top alignment.... I need bottom so that if my string can fit on one line, it sits at the bottom of the text box, not the top.


    I know this doesn't sound entirely logical, but I have to force this information on a preexiting format that I absolutely cannot alter.

    Any suggestions?

  2. #2
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile Re: text box alignment

    Originally posted by sublimsos
    Bottom line up front: Does anyone know how to force text alignment?

    More info:
    I have a text box on a form that concatenates several fields (let's say text1, text2, and text3).... Not all of those fields always have values. If text2 is null, text 3 will be null, etc. The text box that this string goes into has a restricted size (certain height and width), so if it is of a certain length, the text will wrap to the second line. Sometimes the string is one line, sometimes it is two. The text box automatically does top alignment.... I need bottom so that if my string can fit on one line, it sits at the bottom of the text box, not the top.


    I know this doesn't sound entirely logical, but I have to force this information on a preexiting format that I absolutely cannot alter.

    Any suggestions?
    Could you check for the length of the string that will be entered and append some spaces onto it to make it a specified length?

    In other words, if the length of the text will not exceed the width of the box, add enough spaces at the beginning put the actual text at the bottom. I know the string function can implant some spaces if needed.

    Just a thought.
    Gregg


    DAO, ADO, SQL, Automation and anything else I can pick up.

  3. #3
    Join Date
    Jan 2004
    Posts
    75
    Hmm... seems sdrawkcabssa, but hey, that seems to be in keeping with certain aspects of access... I'll certainly give it a try & let you know if it works (gonna take a while... gotta figure out that string counting bit...)

    btw-- I grew up near Roanoke... home, sweet, home

    Thanks for the idea.

  4. #4
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445
    Originally posted by sublimsos
    Hmm... seems sdrawkcabssa, but hey, that seems to be in keeping with certain aspects of access... I'll certainly give it a try & let you know if it works (gonna take a while... gotta figure out that string counting bit...)

    btw-- I grew up near Roanoke... home, sweet, home

    Thanks for the idea.
    If I can get a moment tonight, I'll actually experiment to see how it would work. I'll post as soon as I do if you don't have a solution already.

    Technically, I reside in Bent Mountain, Va but work in Roanoke. The pic is from the Blue Ridge Parkway overlooking Roanoke.
    Gregg


    DAO, ADO, SQL, Automation and anything else I can pick up.

  5. #5
    Join Date
    Jan 2004
    Posts
    75
    Well, it's not the prettiest solution, but it works...

    I did a simple if then statement that checks to see if my seventh field is null (if it is not null, it would force the second line in the text box, if it is null, all subsequent fields will be null).... if it's true, the string is preceeded by a lot of spaces " ", if not, no spaces.


    Viola... works like a charm... not as cool as counting, but it does what I need. Thanks so much for the help!

    Bassett is basically where I'm from... I sure do miss that view some days.

  6. #6
    Join Date
    Jan 2004
    Posts
    75
    I didn't like the last solution... your way is better. I learned Len today

    Dim str1 As String
    str1 = [Forms]![inddatafrm]![Injury1SC] & " " & [Forms]![inddatafrm]![Injury1BP] & IIf(IsNull([Forms]![inddatafrm]![Injury2SC]), "", (", " & [Forms]![inddatafrm]![Injury2SC] & " " & [Forms]![inddatafrm]![Injury2BP])) & IIf(IsNull([Forms]![inddatafrm]![Injury3SC]), "", (", " & [Forms]![inddatafrm]![Injury3SC] & " " & [Forms]![inddatafrm]![Injury3BP])) & IIf(IsNull([Forms]![inddatafrm]![Injury4SC]), "", (", " & [Forms]![inddatafrm]![Injury4SC] & " " & [Forms]![inddatafrm]![Injury4BP]))
    If Len(str1) > 70 Then
    diagnosistxt = str1
    Else
    diagnosistxt = " " & str1
    End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •