Enabled field shows grayed when editing

  • Thread starter Thread starter JB_VB via AccessMonster.com
  • Start date Start date
J

JB_VB via AccessMonster.com

I've created a data entry form that becomes enabled when a check-box is
checked. It works fine when I'm in entry, but it shows up as grayed when I
go back to edit the record. How do I keep the field enabled when I'm in both
entry and edit mode? I'm sure it's something simple but can't find it.

Thanks in advance!
 
JB_VB said:
I've created a data entry form that becomes enabled when a check-box is
checked. It works fine when I'm in entry, but it shows up as grayed when I
go back to edit the record. How do I keep the field enabled when I'm in both
entry and edit mode? I'm sure it's something simple but can't find it.

Thanks in advance!

Oh yeah, here's the code:

Private Sub Other_Issues_Click()
Me.IssueName.Enabled = True

If Other_Issues.Value = no Then
Me.IssueName.Value = ""
Me.IssueName.Enabled = False
End If
End Sub
 
JB_VB wrote:
I've created a data entry form that becomes enabled when a check-box is
checked. It works fine when I'm in entry, but it shows up as grayed with the
data visible when I go back to edit the record. How do I keep the field
enabled when I'm in both entry and edit mode? I'm sure it's something
simple but can't find it.

Here's the code:

Private Sub Other_Issues_Click()
Me.IssueName.Enabled = True

If Other_Issues.Value = no Then
Me.IssueName.Value = ""
Me.IssueName.Enabled = False
End If
End Sub

Is there some code that I need to add to the data field to keep it enabled
when there's data in it? The check-mark stays there when I'm in edit mode,
but the field is gray when it should be normal.

Thanks in advance!
 
Any time you base one control's formatting (in this case whether it's enabled
or not) on another control's state, you have to also include conditional
formatting code in the Form_Current sub.


Private Sub Form_Current()
If Other_Issues Then 'if the checkbox is checked
Me.IssueName.Enabled = True
Else 'if checkbox is not checked
Me.IssueName.Enabled = False
End If
End Sub

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
missinglinq said:
Any time you base one control's formatting (in this case whether it's enabled
or not) on another control's state, you have to also include conditional
formatting code in the Form_Current sub.

Private Sub Form_Current()
If Other_Issues Then 'if the checkbox is checked
Me.IssueName.Enabled = True
Else 'if checkbox is not checked
Me.IssueName.Enabled = False
End If
End Sub

I'm getting there, but not quite: this works when I'm in edit mode. When I
try to enter a new record I get a runtime error 94 - Invalid use of Null.
Any suggestions?
 

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

Back
Top