Disable button in subform?

tpickles1984

Registered User.
Local time
Today, 09:07
Joined
Feb 5, 2003
Messages
19
I'm having two problems in on really, so here goes! I'm trying to create a button to disable another button in a subform, but it does not seem to recognise the subform in the expression. The code is as follows:

[Forms]![FrmHarnessSetup]![SfrmHarnessSetup]![Command12].Enabled = No

I simply can't work out why it doesn't work. If I get it to refer to a button in the main form, that works, and if I get it to refer to the subform when it's opened seperately, that works too. But for some reason, it doesn't understand the expression when I try to refer to the subform within the main form. Any ideas about this?

The other thing that I'm having trouble with is that when I got it to refer to just the subform on its own, it disabled the button in every record, not just the one for the currently selected record. How do I get it to refer to just the currently selected record?

Thanks a lot, any help would be much appreciated
 
The best way (IMO) is to use the OnCurrent event of your SubForm to Enable or Disable the button in question.
HTH

BTW, it's...
Code:
          Me.YourButton.Enabled = False
 
Last edited:
Forms!lYourMainForm!YourSubForm!YourCmdBtn.enabled = False (or True)
If the subform is a continuous form, you will not be able to enable THE command button in one row and simultaneously disable it in another row. To my knowledge, its ONE command button (consequently, one set of properties) displayed in each row. You CAN detect in which row the button is clicked by sampling a unique field.
 
Right, I think I understand what you're saying! I think what I'm trying to do with the form is a bit too complicated, I don't think I can get Access to do it! I'm going to have to tackle the problem in a slightly different way I think. Thanks for the help, I'll try and bare it all in mind!
 

Users who are viewing this thread

Back
Top Bottom