By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,285 Members | 1,687 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,285 IT Pros & Developers. It's quick & easy.

Show/Hide form fields based on values in other field

P: n/a
Looking to do sort of the same thing you see on websites, but on
access form, where when a value is selected from a drop down list, if
it matches the desired value, certain form fields appear.

For example, the records in my table are one of three types of
records, Owner, Member or Independent. I have fields in the table that
only correspond to Owner records and only want those fields showing on
the form if the CompanyType is selected as Owner.

It is the same with Member and Independent. Although it's not
important, it would be cool if this could happen in the same space on
the form.

Can anyone help?

Aug 2 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
magmike <ma******@yahoo.comwrote in
news:11**********************@m37g2000prh.googlegr oups.com:
Looking to do sort of the same thing you see on websites, but
on access form, where when a value is selected from a drop
down list, if it matches the desired value, certain form
fields appear.

For example, the records in my table are one of three types of
records, Owner, Member or Independent. I have fields in the
table that only correspond to Owner records and only want
those fields showing on the form if the CompanyType is
selected as Owner.

It is the same with Member and Independent. Although it's not
important, it would be cool if this could happen in the same
space on the form.

Can anyone help?
Sure...Each textbox has a visible property. Create a sub
procedure in the form's code module, and call that sub from the
form's current event, and the dropdown's afterUpdate event, too.

You didn't give control names, so use this as a template.

private sub cboRecordType_ShowHide()
select case cboRecordType
case "Owner"
me.txtaaaa visible = true
me.txtbbbb.visible = False
me.txtcccc.visible = false
case "Member"
me.txtaaaa visible = false
me.txtbbbb.visible = true
me.txtcccc.visible = false
case Else
me.txtaaaa visible = false
me.txtbbbb.visible = false
me.txtcccc.visible = true
end select
end sub



--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Aug 2 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.