Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'Hiding' blank rows in my form

Status
Not open for further replies.

ChrisTheAncient

Technical User
Dec 22, 2002
169
0
0
GB

I did try this thought process in the vb forum, but I now feel it is more Access specific than vb specific.

I'm using Acc XP with a need to later convert 'down' to A97 as well.

My form is based on a table with three fields...

Task - a text field, Complete - a yes/no and Score - an option group returning a number value.

The idea is that any row may have a defined task that is to be completed and then a score given.

There are 25 rows with Task1, Complete1, Score1 then Task2, Complete2, Score2 etc... through to Task25, Complete25, Score25.

Not every user of the database may necessarily use all 25 tasks, so I was working on a system that 'hides' the row if there is nothing defined as a task for that row.

When the form is opened, the event procedure I have got working so far works for any given row. The code goes...

Code:
Private Sub Form_Open(Cancel As Integer)

[COLOR=green]'***** set up the rows to visible if there is a task defined[/color]

    If Task1 > "" Then
        Task1.Visible = True
        Complete1.Visible = True
        Complete1.Enabled = True
        If Complete1 = False Then
            FrameScore1.Visible = False
            FrameScore1.Enabled = False
        End If
        Else
            Task1.Visible = False
            Complete1.Visible = False
            Complete1.Enabled = False
            FrameScore1.Visible = False
            FrameScore1.Enabled = False
    End If
            
End Sub

And that works really fine and dandy - on a row by row basis.

Now if I didn't care about my programming, I'd just repeat that whole routine for each of the 25 rows and just change the suffix type number.

But...

I'm flipping sure that this must be able to be done using For...Next... looping. I've read as much as possible from the 'Help' system as I can about loops and arrays. But I'm getting nowhere! As my tag says, I'm stoopid, and you can see from the code above, I'm not a particular whizz at it.

Can you offer any more light on the subject before my last brain cell frazzles away to nothing?

TIA

Chris

*************************************
OK, I'm stoopid. But I'm good at it!
*************************************
 
Are you using this subform to just display data. From the coding it looks to me as though all your visible properties are dependant on existing data. Are you looking to enter data into this subform or just view it.

Another note to simplify your code, you don't need to use the enabled property in the code. If the visible property is false it is not usable.

Aaron
 
Maybe conditional formatting is an option ? (ac2k or above)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top