vba courses london - disabling field subform main

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft VBA Training and help » vba courses london - Disabling a field in a subform from the main form | VBA forum

vba courses london - Disabling a field in a subform from the main form | VBA forum

resolvedResolved · Low Priority · Version Standard

Susan has attended:
Access VBA course

Disabling a field in a subform from the main form

I have a form with a subform in it. I can disable the fields in the main form with me.fieldname.enabled = false but I also need to disable all occurences of another field in the subform which could have several occurrences. How do I do this?

Thanks.

Sue

RE: disabling a field in a subform from the main form

Hi Susan

Sorry for the delay in getting back to you, but this was a slightly complex VBA question and we had to wait for one of our advanced VBA trainers to become available to answer the question.

So our trainer Peter has the following code for you.

Function DisableFieldOnSubform()
'Main Form is called Orders
'Sub Form is called - Orders subform
'and field is called unitprice.
'This form arrangement can be found in Northwind.mdb

Forms.Orders.[Orders Subform].Form.UnitPrice.Enabled = False
End Function


Hope this helps

David

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

VBA tip:

Good coding practice

It is important that you always comment the VBA code that you write. By doing this it will make the code much easier to read, as both yourself and other people will be able to see what the code is doing or meant to be doing. This is very important if there is more than one person who writes code in the company as you may have different styles of coding and may not really understand what the other person is trying to do. Also if you write some code and then do not touch it for a year or so you may actually forget what it is meant to be doing. so it is very important to include comments throughout your code and try and make sure that they are as useful as possible

View all VBA hints and tips


Server loaded in 0.08 secs.