Continuous Form enable text box on current record

joeserrone

The cat of the cul-de-sac
Local time
Today, 19:48
Joined
Dec 17, 2006
Messages
164
Hello Everyone,
I have a Continous Form in Access to enter data, I have a textbox called "txbstartenter" thatI want to keep Disabled until the user doesn't press a button, then this textbox can become enabled and the user can edit information in it. I made the txbstartenter disabled by default and in the button I've placed the code:
with txbstartenter
.enabled = True
.value = now

However I realize that once I do that the txbstartenter box becomes enabled for new Records. How can I make this text box only enabled for the Current Record the user is working once they press this button and keep it disabled for new records?

Thanks
 
In Continuous Forms a text box which is bound is bound to all of the records bound by the form. From what I think you are trying to do, if you have an unbound text box to turn on and off it will only be on the record which has the focus. You can transfer the data from the textbox to the records field under the AfterUpdate event.

Hello Everyone,
I have a Continous Form in Access to enter data, I have a textbox called "txbstartenter" thatI want to keep Disabled until the user doesn't press a button, then this textbox can become enabled and the user can edit information in it. I made the txbstartenter disabled by default and in the button I've placed the code:
with txbstartenter
.enabled = True
.value = now

However I realize that once I do that the txbstartenter box becomes enabled for new Records. How can I make this text box only enabled for the Current Record the user is working once they press this button and keep it disabled for new records?

Thanks
 
Thanks for the suggestion, and what type of code do I need in my after update event to transfer this information to the table?
 
All you need to do to set the enabled property back to No when moving to another record is:

Code:
Private Sub Form_Current()
 txbstartenter.Enabled = False
End Sub
 
BTW,

...if you have an unbound text box to turn on and off it will only be on the record which has the focus.

is incorrect! Bound or unbound, what you do to a control on one record you do to that control on all records in a Continuous View Form! When you're talking about Enabling or Locking, as we are here, you simply reset the property when moving to another record, as my code above does.
 
Is there a way to keep the old record enabled for editing and lock the new one?
 
Not with what you've given us. You'd have to click your button again.

To only allow some records to remain editable and others not, you'd have to have a bound control, such as a checkbox, to indicate which records can be edited and which can't. Then set the enabled property accordingly, once again using the Form_Current event. To keep an entire record editable you'd use Me.AllowEdits and set it to True or False depending on the checkbox.

Another approach would be to set these properties, again in the Form_Current event, depending on whether or not some or all controls are populated.
 
I took your suggestions and created a checkbox in the table and left it as False for default, then once the user presses a button the checkbox becomes enable. I also added a code to the on current of the form but still I can't get it to do what you suggested. Attached is the example of the database...... Let me know what you think!
 

Attachments

In your Form_Current event, you need to tell Access not only what to do if RecordSelector is True, but what to do if it is False.

Code:
Private Sub Form_Current()

If Me.RecordSelector = True Then
  Me.txbStartEnter.Enabled = True
  Me.txbEndEnter.Enabled = True
Else   'If RecordSelector is not ticked
  Me.txbStartEnter.Enabled = False
  Me.txbEndEnter.Enabled = False
End If

End Sub
 

Users who are viewing this thread

Back
Top Bottom