working with on entry and on exit properties of a control

L

LeLe

I have set my form to be non editable when it first loads by setting the
allow edits property to no. I then added a button called edit record so the
user can make changes. I want to change the appearance of the controls when
the form is "allowing edits" I have done this many times by changing the
property for on entry and exit, but I can't figure out how to make this only
happen when in "edit mode" I also have the added complication of a subform
which I would like to work the same way. Here is my code so far...

Private Sub EditRecordBut_Click()
Me.AllowEdits = True 'Allow changes on the Order form
Forms![OrderEntry]![LineItemOrderEntry].Form.AllowEdits = True ' Allow
changes on the line item subform
CustomerName.SetFocus 'Move the focus to the first field
End Sub

Private Sub CustomerName_Enter()
Me.CustomerName.BackColor = 8454143
End Sub

Private Sub CustomerName_Exit(Cancel As Integer)
Me.Sidemark.BackColor = 2147483643
End Sub

Thanks
 
J

Jeanette Cunningham

Hi,
One solution I have seen is a large box or label on the form. Make sure is
sent to back.
When the form is in Edit mode, set the backcolour of the box/label to
TheColour, when not in edit mode, set its backcolour to transparent or
whatever you want.
Please note that bright colours are very unpleasant for the user, as I found
with a database I was fixing.


Jeanette Cunningham
 
S

Steve Schapel

LeLe,

If I understand you correctly, I think this is the type of thing you are
after...

Private Sub CustomerName_Enter()
If Me.AllowEdits Then
Me.CustomerName.BackColor = 8454143
End If
End Sub
 
L

LeLe

Thanks so much Steve. Such a simple solution. I should have been able to
figure it out myself, but I couldn't, well at least not yet. Hopefully,
eventually.

Steve Schapel said:
LeLe,

If I understand you correctly, I think this is the type of thing you are
after...

Private Sub CustomerName_Enter()
If Me.AllowEdits Then
Me.CustomerName.BackColor = 8454143
End If
End Sub

--
Steve Schapel, Microsoft Access MVP
I have set my form to be non editable when it first loads by setting the
allow edits property to no. I then added a button called edit record so the
user can make changes. I want to change the appearance of the controls when
the form is "allowing edits" I have done this many times by changing the
property for on entry and exit, but I can't figure out how to make this only
happen when in "edit mode" I also have the added complication of a subform
which I would like to work the same way. Here is my code so far...

Private Sub EditRecordBut_Click()
Me.AllowEdits = True 'Allow changes on the Order form
Forms![OrderEntry]![LineItemOrderEntry].Form.AllowEdits = True ' Allow
changes on the line item subform
CustomerName.SetFocus 'Move the focus to the first field
End Sub

Private Sub CustomerName_Enter()
Me.CustomerName.BackColor = 8454143
End Sub

Private Sub CustomerName_Exit(Cancel As Integer)
Me.Sidemark.BackColor = 2147483643
End Sub

Thanks
 
V

Veerman

Julie Watson said:
LeLe said:
I have set my form to be non editable when it first loads by setting the
allow edits property to no. I then added a button called edit record so
the
user can make changes. I want to change the appearance of the controls
when
the form is "allowing edits" I have done this many times by changing the
property for on entry and exit, but I can't figure out how to make this
only
happen when in "edit mode" I also have the added complication of a
subform
which I would like to work the same way. Here is my code so far...

Private Sub EditRecordBut_Click()
Me.AllowEdits = True 'Allow changes on the Order form
Forms![OrderEntry]![LineItemOrderEntry].Form.AllowEdits = True ' Allow
changes on the line item subform
CustomerName.SetFocus 'Move the focus to the first field
End Sub

Private Sub CustomerName_Enter()
Me.CustomerName.BackColor = 8454143
End Sub

Private Sub CustomerName_Exit(Cancel As Integer)
Me.Sidemark.BackColor = 2147483643
End Sub

Thanks
 
W

wim

niet meer zenden
Julie Watson said:
"LeLe" <LeLe@discussions.
I have set my form to be non editable when it first loads by setting the
allow edits property to no. I then added a button called edit record so
the
user can make changes. I want to change the appearance of the controls
when
the form is "allowing edits" I have done this many times by changing the
property for on entry and exit, but I can't figure out how to make this
only
happen when in "edit mode" I also have the added complication of a
subform
which I would like to work the same way. Here is my code so far...

Private Sub EditRecordBut_Click()
Me.AllowEdits = True 'Allow changes on the Order form
Forms![OrderEntry]![LineItemOrderEntry].Form.AllowEdits = True ' Allow
changes on the line item subform
CustomerName.SetFocus 'Move the focus to the first field
End Sub

Private Sub CustomerName_Enter()
Me.CustomerName.BackColor = 8454143
End Sub

Private Sub CustomerName_Exit(Cancel As Integer)
Me.Sidemark.BackColor = 2147483643
End Sub

Thanks
 

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