referencing a form control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form and subform arrangement. I want to bring information form the
form to the subform which I have done before. But the computer is winning
tonight.

I used

Me.frmTask.txtSubSectionID = Me.SubSectionID
I get Error 2465 can't find the field "frmTask" referred...

I have also used

Me!frmTask!txtSubSectionID = Me.SubSectionID
This one works on another subform on the same main form. This setup now
gives me Method or data member not found.

Both highlight the .frmTask
This is spelled correctly. I double checked by pasting it from the property
dialog box.

Thank you. Fay
 
Fay,

The name of the subform control on the main form, and the name of the
form which is used as the subform, are not necessarily the same. If
they are different, it is the name of the subform control on the main
form that you should be using.

Some people use a more complete reference to a control on a subform,
like this...
Me.frmTask.Form!txtSubSectionID

Also, double-check the spelling of txtSubSectionID for the name of the
contol on the subform.
 
I looked in the property box for the main form and frmTask is listed as a
control. I pasted and copied the name of txtSubSectionID to the code. I used
your suggestion of the second format.

Still not working. The name of the subfrom has to be the name listed in the
property box doesn't it? The Intellisence programming doesn't find it when I
start typing Me....

I have placed a stripped down version of the database at
http://www.awarenessproductions.com/my.htm and click the database link at the
top left area of the form. Thank you for your assistance.
 
Fay,

I had a look at your database. It is not clear to me what you intend,
but the code you mentioned is assigned on the After Update event of the
txtTask control on the frmTask form. This will not work. I had assumed
you were running the code from somewhere on the main form, in which case
the Me.frmTask syntax would be correct in referring to the frmTask
subform. But when you have the code on the frmTask form itself, then
Me.frmTask would indicate a control called frmTask on the frmTask form,
which obviously isn't the case. Hope that helps to clarify the root of
the problem.
 
Fay

Are you trying to popluate the taskid field in the frmSubTask ?

if yes go to the taskid field in the subform (frmSubTask)

In the default value enter :

=[Forms]![frmTasks]![frmTask].[Form]![TaskID]

is this what you are trying to acheive ?

Paul
 
Back
Top