Hide textboxes with no records and move/shift left visible txtboxes on a form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • OfficeDummy
    New Member
    • Jan 2008
    • 18

    Hide textboxes with no records and move/shift left visible txtboxes on a form

    Hello, everyone!

    I have a search form with 12 checkboxes (= 12 months), and another form which displays the search results. On the display form, I'd love to display only the months that have been ticked on the search form and hide the others.

    Now comes the questions of layout - how can I move/shift the visible textboxes so that there're no holes/blank spaces on the display form?

    Here's the code snippet of what I've got so far, but there's an error there:

    Code:
    If Me("ck" & i).Value Then
                 Forms!FrmAusgabe_Monat("txt" & i).Visible = True
        Else
                Forms("FrmAusgabe_Monat").Controls("txt" & i).Visible = False
                
        End If
    Any suggestions? I'm getting really desperate here!!!

    Thanks a lot in advance,
    OfficeDummy
  • JustJim
    Recognized Expert Contributor
    • May 2007
    • 407

    #2
    Originally posted by OfficeDummy
    Hello, everyone!

    I have a search form with 12 checkboxes (= 12 months), and another form which displays the search results. On the display form, I'd love to display only the months that have been ticked on the search form and hide the others.

    Now comes the questions of layout - how can I move/shift the visible textboxes so that there're no holes/blank spaces on the display form?

    Here's the code snippet of what I've got so far, but there's an error there:

    Code:
    If Me("ck" & i).Value Then
                 Forms!FrmAusgabe_Monat("txt" & i).Visible = True
        Else
                Forms("FrmAusgabe_Monat").Controls("txt" & i).Visible = False
                
        End If
    Any suggestions? I'm getting really desperate here!!!

    Thanks a lot in advance,
    OfficeDummy
    Hi,
    A quick and dirty method would be just to have one (wide) textbox and set it's value to a concatenated series of values with lots of IIF statements.

    Warning: Air Code follows
    TextBox.Value = Iif(chkJan,JanV alue,"") & " " & Iif(chkFeb,FebV alue,"") & ..... etc

    Jim
    PS this would give a leading space characher if chkJan were false, two leading spaces if chkJan and chkFeb were both false, etc. It could be worked though.
    Last edited by JustJim; Mar 20 '08, 01:10 PM. Reason: PS

    Comment

    Working...