passing value to a popup form not working

D

dgreen

Here's what I have.
The main form is a tab view with 5 tabs: FiveTabView
The first tab has 2 subforms both of which are datasheets.
two subforms: COMMENT Datasheet
PUBLIC_CONCERN TAB1 Datasheet

I need one field, PublicConcern, on 'PUBLIC_CONCERN TAB1 Datasheet'
to be passed to the popup form.

The popup form is: CommentPopUpInputForm
with one field: CommentInputBox (unbound)

On the 'CommentPopUpInputForm.Before Insert' there is an event procedure.
Here's the code with all my tries:

Private Sub Form_BeforeInsert(Cancel As Integer)
Rem Me.CommentInputBox = Forms!FiveTabView![PUBLIC_CONCERN TAB1
Datasheet]!PublicConcern
Rem Me.CommentInputBox = Forms!FiveTabView!PUBLIC_CONCERN!PublicConcern
Rem Me.CommentInputBox = Forms!FiveTabView![1. Public
Concern]!PUBLIC_CONCERN!PublicConcern
Rem Me.CommentInputBox = Forms!FiveTabView![1. Public
Concern]![PUBLIC_CONCERN TAB1 Datasheet]!PublicConcern
Rem Me.CommentInputBox = Forms!FiveTabView![1. Public
Concern]![PUBLIC_CONCERN TAB1 Datasheet]!PublicConcern
Rem Me.CommentInputBox = Forms!FiveTabView![1. Public
Concern]![PUBLIC_CONCERN TAB1 Datasheet].[Form]!PublicConcern

Me.CommentInputBox = [Forms]![FiveTabView]![1. Public
Concern]![PUBLIC_CONCERN TAB1 Datasheet].[Form]![PublicConcern]

End Sub

The popup form appears but the value is not being passed.
If the field in the datasheet is empty, the popup form is used to enter
text.
If the field is not empty, the popup is used to edit the text.
(I initially used the Zoom box but the customer wanted a much bigger box)

I've searched the group to get where I am now (THANKS!!! to all) but have
reached a stumping point.

Any help/suggestions are greatly appreciated.
 
W

Wayne Morgan

The syntax to refer to a control on a subform of another form is:

Forms!NameOfOtherForm!NameOfSubformControl.Form!NameOfControl

The NameOfSubformControl is the name of a control on the main form. It may
or may not be the same as the name of the subform itself. The subform
control is where you set the Parent/Child link field settings, this is the
control that you need the name of. Use brackets as needed around names with
spaces in them.
 
D

dgreen

Thanks Wayne for the info. I'm wondering about the way the form is set up
and the order in the reference. The main form has TABS on it. The first TAB
has the two subforms.

My syntax for the reference is:
[Forms]![FiveTabView]![1. Public Concern]![PUBLIC_CONCERN TAB1
Datasheet].[Form]![PublicConcern]

where it is
forms ! main form ! TAB name ! sub form name ! control

You don't mention the TABS in your solution. Do I need to include the TAB
name or just main form and then the sub form?

THANKS!!!

Wayne Morgan said:
The syntax to refer to a control on a subform of another form is:

Forms!NameOfOtherForm!NameOfSubformControl.Form!NameOfControl

The NameOfSubformControl is the name of a control on the main form. It may
or may not be the same as the name of the subform itself. The subform
control is where you set the Parent/Child link field settings, this is the
control that you need the name of. Use brackets as needed around names with
spaces in them.

--
Wayne Morgan
MS Access MVP


dgreen said:
Here's what I have.
The main form is a tab view with 5 tabs: FiveTabView
The first tab has 2 subforms both of which are datasheets.
two subforms: COMMENT Datasheet
PUBLIC_CONCERN TAB1 Datasheet

I need one field, PublicConcern, on 'PUBLIC_CONCERN TAB1 Datasheet'
to be passed to the popup form.

The popup form is: CommentPopUpInputForm
with one field: CommentInputBox (unbound)

On the 'CommentPopUpInputForm.Before Insert' there is an event procedure.
Here's the code with all my tries:

Private Sub Form_BeforeInsert(Cancel As Integer)
Rem Me.CommentInputBox = Forms!FiveTabView![PUBLIC_CONCERN TAB1
Datasheet]!PublicConcern
Rem Me.CommentInputBox = Forms!FiveTabView!PUBLIC_CONCERN!PublicConcern
Rem Me.CommentInputBox = Forms!FiveTabView![1. Public
Concern]!PUBLIC_CONCERN!PublicConcern
Rem Me.CommentInputBox = Forms!FiveTabView![1. Public
Concern]![PUBLIC_CONCERN TAB1 Datasheet]!PublicConcern
Rem Me.CommentInputBox = Forms!FiveTabView![1. Public
Concern]![PUBLIC_CONCERN TAB1 Datasheet]!PublicConcern
Rem Me.CommentInputBox = Forms!FiveTabView![1. Public
Concern]![PUBLIC_CONCERN TAB1 Datasheet].[Form]!PublicConcern

Me.CommentInputBox = [Forms]![FiveTabView]![1. Public
Concern]![PUBLIC_CONCERN TAB1 Datasheet].[Form]![PublicConcern]

End Sub

The popup form appears but the value is not being passed.
If the field in the datasheet is empty, the popup form is used to enter
text.
If the field is not empty, the popup is used to edit the text.
(I initially used the Zoom box but the customer wanted a much bigger box)

I've searched the group to get where I am now (THANKS!!! to all) but have
reached a stumping point.

Any help/suggestions are greatly appreciated.
 
W

Wayne Morgan

No, you don't need to include the tabs. The controls on the tab are also
considered to be part of the main form. As proof of this, try giving
controls on different tabs the same name.

--
Wayne Morgan
MS Access MVP


dgreen said:
Thanks Wayne for the info. I'm wondering about the way the form is set up
and the order in the reference. The main form has TABS on it. The first
TAB
has the two subforms.

My syntax for the reference is:
[Forms]![FiveTabView]![1. Public Concern]![PUBLIC_CONCERN TAB1
Datasheet].[Form]![PublicConcern]

where it is
forms ! main form ! TAB name ! sub form name ! control

You don't mention the TABS in your solution. Do I need to include the TAB
name or just main form and then the sub form?

THANKS!!!

Wayne Morgan said:
The syntax to refer to a control on a subform of another form is:

Forms!NameOfOtherForm!NameOfSubformControl.Form!NameOfControl

The NameOfSubformControl is the name of a control on the main form. It
may
or may not be the same as the name of the subform itself. The subform
control is where you set the Parent/Child link field settings, this is
the
control that you need the name of. Use brackets as needed around names
with
spaces in them.

--
Wayne Morgan
MS Access MVP


dgreen said:
Here's what I have.
The main form is a tab view with 5 tabs: FiveTabView
The first tab has 2 subforms both of which are datasheets.
two subforms: COMMENT Datasheet
PUBLIC_CONCERN TAB1 Datasheet

I need one field, PublicConcern, on 'PUBLIC_CONCERN TAB1 Datasheet'
to be passed to the popup form.

The popup form is: CommentPopUpInputForm
with one field: CommentInputBox (unbound)

On the 'CommentPopUpInputForm.Before Insert' there is an event
procedure.
Here's the code with all my tries:

Private Sub Form_BeforeInsert(Cancel As Integer)
Rem Me.CommentInputBox = Forms!FiveTabView![PUBLIC_CONCERN TAB1
Datasheet]!PublicConcern
Rem Me.CommentInputBox =
Forms!FiveTabView!PUBLIC_CONCERN!PublicConcern
Rem Me.CommentInputBox = Forms!FiveTabView![1. Public
Concern]!PUBLIC_CONCERN!PublicConcern
Rem Me.CommentInputBox = Forms!FiveTabView![1. Public
Concern]![PUBLIC_CONCERN TAB1 Datasheet]!PublicConcern
Rem Me.CommentInputBox = Forms!FiveTabView![1. Public
Concern]![PUBLIC_CONCERN TAB1 Datasheet]!PublicConcern
Rem Me.CommentInputBox = Forms!FiveTabView![1. Public
Concern]![PUBLIC_CONCERN TAB1 Datasheet].[Form]!PublicConcern

Me.CommentInputBox = [Forms]![FiveTabView]![1. Public
Concern]![PUBLIC_CONCERN TAB1 Datasheet].[Form]![PublicConcern]

End Sub

The popup form appears but the value is not being passed.
If the field in the datasheet is empty, the popup form is used to enter
text.
If the field is not empty, the popup is used to edit the text.
(I initially used the Zoom box but the customer wanted a much bigger
box)

I've searched the group to get where I am now (THANKS!!! to all) but
have
reached a stumping point.

Any help/suggestions are greatly appreciated.
 

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