Current Control Only on Continuous Form

Bagel

Registered User.
Local time
Today, 17:23
Joined
Jun 13, 2003
Messages
15
I am having trouble with a continuous form setting Enabled to False in the current record only. I have tried code in the OnCurrent of the form and OnOpen, examples like

If Me.NewRecord then
Me!Quantity.Enabled = False
.....

also

If Me.NewRecord = True then 'if this makes any difference?

Dataentry is set to Yes and have tried No also with no difference.

So I can set all [Quantity].enabled to false but I only want to set the New Record, not all the records I have already created.

Any help would be appreciated as I still have a pretty basic knowledge of Access
 
A search on "Continuous Form Current Record" returns 134 threads.
 
Bagel, set form's BeforeInsert and AfterInsert events. Note that inorder to disable to control it must not have the focus so make sure to move the focus to a different control. The code below does that since the user can click on the Quantity field and give the control the focus, the moment they try to type in the new record, the field is disabled and the focus given to a different control. Once the record has been entered, the Quantity field becomes available for editing since it will be disabled while the record is being added.

Private Sub Form_AfterInsert()
Someotherfield.SetFocus
Quantity.Enabled = True
End Sub

Private Sub Form_BeforeInsert(Cancel As Integer)
Someotherfield.SetFocus
Quantity.Enabled = False
End Sub
 
You can't set individual records properties on a continuous form in this way, altering the status for an individual records control will alter them all.
You could try setting the quantity enabled back to true on the After Update of the form
 
Rich, I tried the code I suggested and it worked fine. Setting the control while the new record is being edited should be fine since once the record is no longer being edited will restore the control to enabled. That is why it has the BeforeInsert and AfterInster events set.
 
Thanks Rich and GodofHell for your replies.

Mr/Mrs hell I have tried what you have suggested and yes it works well but I still have the same problem as before being that if I set the quantity.enabled then it does this for all Quantity controls on the continuous report, not just the current control, is there something I have missed?
On reply from Lagbolt I spent the entire day checking through the forums, this didn't seam to help me however I did find a reply from Pat stating that what you do to one control, you do to all the same controls on a continuous form.
Does this sound about right to you both?
 

Users who are viewing this thread

Back
Top Bottom