Subforms and VBA

aweizd

Registered User.
Local time
Today, 14:05
Joined
Apr 8, 2005
Messages
12
Hi,

I have a (master) form in Single Form view. In this form I have a subform, which displays a list of other record that have the same GroupID as the record viewed in the master form. Obviously the list will also display the record viewed in the master form, so next to it i want to place something like a label "Currently open".

In the subform I created this lable and made it invisible, then I have a VBA script to check if the listed record matches the master record (using RecordID) and eventually make the label visible. The master RecordID is fetched from a global variable using the FetchRecordID() function.

I get the feeling I've done this completely wrong.
I used the Form_Current event of the subform to run the script and this is what it looks like:
Code:
Private Sub Form_Current()

    If Me.RecordID = FetchRecordID() Then
        Me.CurrentLabel.Visible = True
    End If

End Sub
The result is a list but none of the records have the "Currently open" label visible, but when I click on the record corresponding to the master record then the label appears for all listed records. When I click on a different record the is disappears again. I guess it's due to the Form_Current event, but that was the only one that made sense to me... (I'm still new to this whole Access VBA thing)

If anybody could help me I'd be really grateful...

Thanx
Luke
 
Continuous forms in Access are all fluff and mirrors :rolleyes: What you do to one box you do to all of them.

I have not tried this, but, I think that you could probably do this using Conditional formatting to change the colours of your fields to make the record obvious
HTH

Peter
 
Hi,

Thanks for the tip! It actually works, although the conditional formating option are pretty slim, but I can live with that...

I know I could do it with VBA as well and have more formatting possibilities, but I don't feel like getting into that now :)

Thanks again
Luke
 

Users who are viewing this thread

Back
Top Bottom