Correct syntax for grabbing combobx value from mainfrm to subfrm

B

babs

Posted over in Gen questions but have not heard back yet.

I have a main form named DateBarb with a combo box cboman - It has the Man
name with rate1 in the second column and rate2 in the third column of
combobox


On the subform if the field name [ckRate2BP] is checked I want field in the
subform [ActualRate] (I Named it txtActualRate) but field name is
[actualrate] to grab the the rate2 from the combobox:

Here is my code below - I attached it to the afterupdate event of the
ckRate2BP field on the subform - but also not sure if that is best place
since many times user may not even click on this check box if not second
rate.

I am sure my syntax in referencing the field names and forms in incorrect -
Please help.

datbarbTimeCardMDJEFFSubform2!txtActualRate =
IIf(Me.Form!datbarbTimeCardMDJEFFSubform2!ckRate2BP = yes,
Me.Form!DateBArb!cboman.Column(2), Me.Form!DateBArb!.cboman.Column(1))

Thanks,
Barb
 
D

Douglas J. Steele

Check http://www.mvps.org/access/forms/frm0031.htm at "The Access Web" for a
good reference on how to refer to Form and Subform properties and controls.
Pay close attention to the fact that you must use the name of the subform
control on the parent form. Depending on how you added the form as a
subform, the name of the subform control may be different than the name of
the form being used as a subform.
 
B

babs

I read the great table - thanks!
But still not working - getting this error:
Method or DataMember not Found

Here is my code I Named the Check box txtckRate2BP-on subform - again see
earlier post :
Private Sub txtckRate2BP_AfterUpdate()
Me!txtActualRate = IIf(Me!txtckRate2BP = yes, Me.DateBArb!cboman.Column(2),
Me.DateBArb!.cboman.Column(1))
End Sub


thanks for helping!
Barb
Douglas J. Steele said:
Check http://www.mvps.org/access/forms/frm0031.htm at "The Access Web" for a
good reference on how to refer to Form and Subform properties and controls.
Pay close attention to the fact that you must use the name of the subform
control on the parent form. Depending on how you added the form as a
subform, the name of the subform control may be different than the name of
the form being used as a subform.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


babs said:
Posted over in Gen questions but have not heard back yet.

I have a main form named DateBarb with a combo box cboman - It has the Man
name with rate1 in the second column and rate2 in the third column of
combobox


On the subform if the field name [ckRate2BP] is checked I want field in
the
subform [ActualRate] (I Named it txtActualRate) but field name is
[actualrate] to grab the the rate2 from the combobox:

Here is my code below - I attached it to the afterupdate event of the
ckRate2BP field on the subform - but also not sure if that is best place
since many times user may not even click on this check box if not second
rate.

I am sure my syntax in referencing the field names and forms in
incorrect -
Please help.

datbarbTimeCardMDJEFFSubform2!txtActualRate =
IIf(Me.Form!datbarbTimeCardMDJEFFSubform2!ckRate2BP = yes,
Me.Form!DateBArb!cboman.Column(2), Me.Form!DateBArb!.cboman.Column(1))

Thanks,
Barb
 
D

Douglas J. Steele

You seem not to have read the chart correctly.

If the name of the subform control is DateBArb, and the name of the combo
box on the form being used as a subform is cboman, you'd refer to it as

Me!DateBArb.Form!cboman.Column(2)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


babs said:
I read the great table - thanks!
But still not working - getting this error:
Method or DataMember not Found

Here is my code I Named the Check box txtckRate2BP-on subform - again see
earlier post :
Private Sub txtckRate2BP_AfterUpdate()
Me!txtActualRate = IIf(Me!txtckRate2BP = yes,
Me.DateBArb!cboman.Column(2),
Me.DateBArb!.cboman.Column(1))
End Sub


thanks for helping!
Barb
Douglas J. Steele said:
Check http://www.mvps.org/access/forms/frm0031.htm at "The Access Web"
for a
good reference on how to refer to Form and Subform properties and
controls.
Pay close attention to the fact that you must use the name of the subform
control on the parent form. Depending on how you added the form as a
subform, the name of the subform control may be different than the name
of
the form being used as a subform.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


babs said:
Posted over in Gen questions but have not heard back yet.

I have a main form named DateBarb with a combo box cboman - It has the
Man
name with rate1 in the second column and rate2 in the third column of
combobox


On the subform if the field name [ckRate2BP] is checked I want field in
the
subform [ActualRate] (I Named it txtActualRate) but field name is
[actualrate] to grab the the rate2 from the combobox:

Here is my code below - I attached it to the afterupdate event of the
ckRate2BP field on the subform - but also not sure if that is best
place
since many times user may not even click on this check box if not
second
rate.

I am sure my syntax in referencing the field names and forms in
incorrect -
Please help.

datbarbTimeCardMDJEFFSubform2!txtActualRate =
IIf(Me.Form!datbarbTimeCardMDJEFFSubform2!ckRate2BP = yes,
Me.Form!DateBArb!cboman.Column(2), Me.Form!DateBArb!.cboman.Column(1))

Thanks,
Barb
 
B

babs

Doug,
Thanks for still helping the Main form is DateBarb and the combo box on the
mainform is cboman.

Please ref. original post - I am sure I missed something on the chart but
still can't figure out what -

thanks so much,
Barb

Douglas J. Steele said:
You seem not to have read the chart correctly.

If the name of the subform control is DateBArb, and the name of the combo
box on the form being used as a subform is cboman, you'd refer to it as

Me!DateBArb.Form!cboman.Column(2)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


babs said:
I read the great table - thanks!
But still not working - getting this error:
Method or DataMember not Found

Here is my code I Named the Check box txtckRate2BP-on subform - again see
earlier post :
Private Sub txtckRate2BP_AfterUpdate()
Me!txtActualRate = IIf(Me!txtckRate2BP = yes,
Me.DateBArb!cboman.Column(2),
Me.DateBArb!.cboman.Column(1))
End Sub


thanks for helping!
Barb
Douglas J. Steele said:
Check http://www.mvps.org/access/forms/frm0031.htm at "The Access Web"
for a
good reference on how to refer to Form and Subform properties and
controls.
Pay close attention to the fact that you must use the name of the subform
control on the parent form. Depending on how you added the form as a
subform, the name of the subform control may be different than the name
of
the form being used as a subform.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Posted over in Gen questions but have not heard back yet.

I have a main form named DateBarb with a combo box cboman - It has the
Man
name with rate1 in the second column and rate2 in the third column of
combobox


On the subform if the field name [ckRate2BP] is checked I want field in
the
subform [ActualRate] (I Named it txtActualRate) but field name is
[actualrate] to grab the the rate2 from the combobox:

Here is my code below - I attached it to the afterupdate event of the
ckRate2BP field on the subform - but also not sure if that is best
place
since many times user may not even click on this check box if not
second
rate.

I am sure my syntax in referencing the field names and forms in
incorrect -
Please help.

datbarbTimeCardMDJEFFSubform2!txtActualRate =
IIf(Me.Form!datbarbTimeCardMDJEFFSubform2!ckRate2BP = yes,
Me.Form!DateBArb!cboman.Column(2), Me.Form!DateBArb!.cboman.Column(1))

Thanks,
Barb
 
D

Douglas J. Steele

To refer to combo box cboman on parent form DateBarb, you use
Forms!DateBarb!cboman. Doesn't matter whether you're doing this from the
form itself, from a subform on form DateBarb or from somewhere else in the
application. All that matters is that form DateBarb be open.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


babs said:
Doug,
Thanks for still helping the Main form is DateBarb and the combo box on
the
mainform is cboman.

Please ref. original post - I am sure I missed something on the chart but
still can't figure out what -

thanks so much,
Barb

Douglas J. Steele said:
You seem not to have read the chart correctly.

If the name of the subform control is DateBArb, and the name of the combo
box on the form being used as a subform is cboman, you'd refer to it as

Me!DateBArb.Form!cboman.Column(2)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


babs said:
I read the great table - thanks!
But still not working - getting this error:
Method or DataMember not Found

Here is my code I Named the Check box txtckRate2BP-on subform - again
see
earlier post :
Private Sub txtckRate2BP_AfterUpdate()
Me!txtActualRate = IIf(Me!txtckRate2BP = yes,
Me.DateBArb!cboman.Column(2),
Me.DateBArb!.cboman.Column(1))
End Sub


thanks for helping!
Barb
:

Check http://www.mvps.org/access/forms/frm0031.htm at "The Access Web"
for a
good reference on how to refer to Form and Subform properties and
controls.
Pay close attention to the fact that you must use the name of the
subform
control on the parent form. Depending on how you added the form as a
subform, the name of the subform control may be different than the
name
of
the form being used as a subform.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Posted over in Gen questions but have not heard back yet.

I have a main form named DateBarb with a combo box cboman - It has
the
Man
name with rate1 in the second column and rate2 in the third column
of
combobox


On the subform if the field name [ckRate2BP] is checked I want field
in
the
subform [ActualRate] (I Named it txtActualRate) but field name is
[actualrate] to grab the the rate2 from the combobox:

Here is my code below - I attached it to the afterupdate event of
the
ckRate2BP field on the subform - but also not sure if that is best
place
since many times user may not even click on this check box if not
second
rate.

I am sure my syntax in referencing the field names and forms in
incorrect -
Please help.

datbarbTimeCardMDJEFFSubform2!txtActualRate =
IIf(Me.Form!datbarbTimeCardMDJEFFSubform2!ckRate2BP = yes,
Me.Form!DateBArb!cboman.Column(2),
Me.Form!DateBArb!.cboman.Column(1))

Thanks,
Barb
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top