Updating a field value on another form

mn7

New member
Local time
Today, 13:14
Joined
Feb 8, 2007
Messages
8
Hi.

I have a function that amongst other things updates the value of a field on another form. The function is launched from a command button on the first form.

The first form is called Planning_Applications
The second form is called Custom_fields.
The field I wish to change on Custom_fields is called chkPre_app

I have tried the following;

Forms![Planning_Applications]![Custom_Fields].Form![chkPre_app].value = True

but it fails because it thinks Custom_fields is a field and not a form.

Can someone advise what i'm doing wrong ? I've tried many variations to no avail.

many thanks

Martin.
 
Where you have [CustomFields] (presumably a subform) you must refer to the subform control name rather than the form that is its Source Object.
 
Hi.

Thanks for the reply.

[Custom_fields] is the name of a seperate form, and not a subform. Is there another way to refer to the other form?

many thanks
 
[Custom_fields] is the name of a seperate form, and not a subform. Is there another way to refer to the other form?

Forms![Custom_fields]![chkPre_app]

You don't need to include Value as it is the default property.

I thought you must have known how to refer to forms and subforms because you posted a perfect reference syntax for a control on a subform.

BTW
Just remember the .Form property is the default on main forms and can be left out if you like but must always be included when referring to the property of a subform because it is not the default property of a subformcontrol.

These are the same:
Forrms!formame.Form!controlname
Forms!formname!controlname

But for controls on sub forms:
Form!formname!subformcontrolname.Form!controlname

Never:
Form!formname!subformcontrolname!controlname
 
thanks for your help, that's exactly what I needed.
 

Users who are viewing this thread

Back
Top Bottom