check box to toggle controls enabled not working on saved records

  • Thread starter Thread starter Darryn
  • Start date Start date
D

Darryn

Hi all

I have a number of check boxes on a form which are used the toggle the
enabled status of other controls (I want to disable input into certain
fields if it is not required by the user). I have this working fine
using the following two event proceedures, so when a new record is
being entered the user checks the boxes and the fields are enabled.

Private Sub IsUnique_AfterUpdate()
If Me.IsUnique = True Then
Me.Quantity.Enabled = False
Me.SerialNumber.Enabled = True
Else
Me.Quantity.Enabled = True
Me.SerialNumber.Enabled = False
End If
and
Private Sub YearColourCoded_AfterUpdate()
Me.cboYearColourCode.Enabled = Me.YearColourCoded
End Sub

When I am navigating back through saved records the checkboxes are
still checked but the other controls are being disabled. Is there any
way to refresh or requery the check boxes when a record is reloaded.

I have tried to add the following
Me.Requiresmaintenance.Requery
Into the on current and on load event in the forms property
but it has had no effect and I am at a loss to work out how to do it

Thanks

Darryn
 
Darryn,

I would suggest moving your code as-is to the OnCurrent
Event of the Form. This will get triggered every time you
move from record to record and should do what you are
looking for.

Gary Miller
 
Darryn,

I would suggest moving your code as-is to the OnCurrent
Event of the Form. This will get triggered every time you
move from record to record and should do what you are
looking for.

Sorry to to sound thick but which bit of code?

I have already tried
Private Sub Form_Current()
Me.IsUnique.Requery
Me.RequiresMaintenance.Requery
End sub

But this did nothing

I also just tried to C/Pfrom the IsUnique afer update event but this did nothing either

Darryn
 
Private Sub Form_Current()
If Me.IsUnique = True Then
Me.Quantity.Enabled = False
Me.SerialNumber.Enabled = True
Else
Me.Quantity.Enabled = True
Me.SerialNumber.Enabled = False
End If
End Sub

This will have the form check the values for an existing
record as you move to it and set the controls enabled or not
based on what is already there.

Gary Miller
 
Private Sub Form_Current()
If Me.IsUnique = True Then
Me.Quantity.Enabled = False
Me.SerialNumber.Enabled = True
Else
Me.Quantity.Enabled = True
Me.SerialNumber.Enabled = False
End If
End Sub

This will have the form check the values for an existing
record as you move to it and set the controls enabled or not
based on what is already there.

I was soo close with this one!!
But I had left out this bit!!!
Thanks so much

Darryn
 
Back
Top