Column Hiding based on Selected Criteria

G

Guest

I've got a form/subform that opens based on criteria selected in frmCriteria.
There are 3 criteria you can select in frmCriteria. What I'm trying to do
is hide those columns in the subform, based on the selections made in
frmCriteria. This code works if I select each of the criteria individually,
but I get a run time error 2445 "invalid reference to the property
Form/Report" if I select MORE than one criteria. I've got this code in the
Open Event of the main form.

If Forms!frmCriteria!chkModule = -1 Then
Me!sfrmProgramAccess.Form!MODULE.ColumnHidden = True
Else
If Forms!frmCriteria!chkGroup = -1 Then
Me!sfrmProgramAccess.Form!GROUPID.ColumnHidden = True
Else
If Forms!frmCriteria!chkProg = -1 Then
Me!sfrmProgramAccess.Form!PROGRAMID.ColumnHidden = True
End If
End If
End If

What can I do in order to get this to work with multiple criteria?
 
M

Mark A. Sam

Dear Kirk,

Maybe this is the problem.

Else

If Forms!frmCriteria!chkGroup = -1 Then

ElseIf should be one word not two. Did you complile your module to find
syntax errors?

God Bless,

Mark A. Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top