Using a main form to control the edit properties of a subform using VBA 
Author Message
 Using a main form to control the edit properties of a subform using VBA

I am trying to write some code that will allow me to
change the status on displayed controls on a subform. The
status (locked/enabled/disbaled etc) will be based on a
specific selection within an option group on the main form.

example: I am looking to control the status of multiple
objects (not necessarily all of them) on a subform based
on the option selected(EDIT or
VIEW) within the group of Options in the main form.
if VIEW is selected I want the identified controls on the
sub form
to be read only (Locked). if edit is selected I want the
controls to be editable (unlocked)

If possible I would like to reuse this code for other
subforms that are on also on the main form and controls
there status as well... so I imagaine I will need to write
this in a standard module.

Any help with this issue wil be greatly appreciated.

Regards, and thanks in advance for your help

Jer



Sun, 16 May 2004 03:26:40 GMT  
 Using a main form to control the edit properties of a subform using VBA
You should look at the InSelection in the help file
Then for each control that is selected set the desired property to what is
selected in the mainform.
Use code like this:

Dim ctl As Control
Set ctl = Forms!form1!Text0
ctl.Locked = False

Jan


Quote:
> I am trying to write some code that will allow me to
> change the status on displayed controls on a subform. The
> status (locked/enabled/disbaled etc) will be based on a
> specific selection within an option group on the main form.

> example: I am looking to control the status of multiple
> objects (not necessarily all of them) on a subform based
> on the option selected(EDIT or
> VIEW) within the group of Options in the main form.
> if VIEW is selected I want the identified controls on the
> sub form
> to be read only (Locked). if edit is selected I want the
> controls to be editable (unlocked)

> If possible I would like to reuse this code for other
> subforms that are on also on the main form and controls
> there status as well... so I imagaine I will need to write
> this in a standard module.

> Any help with this issue wil be greatly appreciated.

> Regards, and thanks in advance for your help

> Jer



Sun, 16 May 2004 23:26:06 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Formsearch using main and subform

2. Editing Form Modules using vba

3. Setting control properties using VBA

4. add multiple records to a subform using VBA

5. Using Acc97 and using a main/sub form, how do you find a record by querying for a subform field value?

6. Subform needs to call VB subroutine in main form

7. subform disapppears after requerying main form

8. two subforms on a main form

9. Help in calling subform subroutines from the main form

10. Access 97 - Subform access triggers update for Main Form

11. Subform linked by autonumber field in main form

12. Main form/subform?

 

 
Powered by phpBB® Forum Software