Hiding fields based on conditions in other fields

Anastasia

New member
Local time
Today, 23:22
Joined
Oct 19, 2007
Messages
3
Can anyone help? I'm trying to create a database for three groups of people -headteachers, teachers and others. I have a field which records which of these groups the person belongs to. I need to collect different data in other fields depending on which of these groups they belong to - and I want to set up my form so that these fields only appear when the appropriate type of person is chosen. I have seen it done with yes/no options to hide subforms for, say, active members of a society, but I can't figure out how to do it when you have three different options and want to hide fields.

Is there a way to do this?

Thanks. :confused:
 
Based on the complexity of the requirements, you must set up your database and its security model.

Best if you use the build in security. You need to create your own workgroup file.
 
Clarification

Sorry - maybe not clear enough.

The three groups are people in the database - not people using the database - so I don't think it's a security issue.

If John Smith is a member of staff at one of our schools and is a headteacher, when I chose the 'headteacher' option in my 'Type of staff' box, I want particular fields which I only need to fill in for headteachers to show in my form.

If Jane Jones is a normal member of staff, when I chose the 'teacher' option in the 'Type of staff' field, I need the headteacher-relevant fields to disappear and teacher-related fields to be displayed.

Is that clearer?
 
Clarification

Sorry - maybe not clear enough.

The three groups are people in the database - not people using the database - so I don't think it's a security issue.

If John Smith is a member of staff at one of our schools and is a headteacher, when I chose the 'headteacher' option in my 'Type of staff' box, I want particular fields which I only need to fill in for headteachers to show in my form.

If Jane Jones is a normal member of staff, when I chose the 'teacher' option in the 'Type of staff' field, I need the headteacher-relevant fields to disappear and teacher-related fields to be displayed.

Is that clearer?
 
How about:
This should work as long as you change record between each record, else you could put it on OnUpdate form the type of staff box.

Private Sub Form_Current()

With [Headteacherbox1]
.Visible = (IIf([Type of staff] = "Headteacher", True, False))
End With
With [Headteacherbox2]
.Visible = (IIf([Type of staff] = "Headteacher", True, False))
End With
With [Teacherbox1]
.Visible = (IIf([Type of staff] = "Teacher", True, False))
End With
With [thirdgroupbox1]
.Visible = (IIf([Type of staff] = "Third Group", True, False))
End With

End Sub
 
How about:
This should work as long as you change record between each record, else you could put it on OnUpdate form the type of staff box.

Private Sub Form_Current()

With [Headteacherbox1]
.Visible = (IIf([Type of staff] = "Headteacher", True, False))
End With
With [Headteacherbox2]
.Visible = (IIf([Type of staff] = "Headteacher", True, False))
End With
With [Teacherbox1]
.Visible = (IIf([Type of staff] = "Teacher", True, False))
End With
With [thirdgroupbox1]
.Visible = (IIf([Type of staff] = "Third Group", True, False))
End With

End Sub
 
I would create a table "StaffTypes" with all possible staff types and when necessary join it with the other tables.
You can use a combobox to set the staff type for each person.
 
I would create a table "StaffTypes" with all possible staff types and when necessary join it with the other tables.
You can use a combobox to set the staff type for each person.

<<is there an echo?>>
 

Users who are viewing this thread

Back
Top Bottom