Enabling and Disabling fields

S

Stacie Fugate

I have a form that has many fields on it. When certain
values are chosen, certain other fields will be
disabled. Likewise, when certain values are chosen,
certain other fields will be enabled. On the screen, and
when the form is printed, it looks fine. However, when
you have to get back into Access and recall that record,
the fields that were previously disabled have become
enabled again, and the fields that had been previously
enabled have become enabled again. The only way to get
the field to be correctly enabled or disabled again is to
go back to the field and use the combo box again to
select the same value (even though the field already
contains the value that should enable or disable the
other field). How do I get the fields to stay either
enabled or disabled depending on what was previously
entered? And will the solution work for also enabling
and disabling the visibility of fields also? Because I
have the same problem with enabling and disabling the
visibility of fields depending on what values were
previously selected.

Any help would be greatly appreciated!

Thanks!
Stacie
 
J

Jack Doria

Stacie,

If I understand your problem correctly it has to do with the event from
which your code is fired. So currently there is code behind the AfterUpdate
event of the combo boxes (or some similar event), but to ensure that the
proper fields are enabled/disabled or visible/invisible when you move record
to record, you should use the Current event of the form. For Example:

Private Sub Form_Current()
Me.Field1.Enabled = (Me.cboComboBox1 = SomeValue)
Me.Field1.Visible = (Me.cboComboBox1 = SomeValue)
End Sub

Jack
 

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