Referencing another form

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

Guest

Hiya!

I'm trying to set something up to help one of our folks track our shipments,
and I would like it to look on another subform to see what's going on, but I
keep getting errors.

So basically, this form has two subforms. One to display contact
information for the plant we're shipping to as chosen by a combo box on the
main form, and another subform that lets him enter the specifics of that
shipment, PO #, ship date and type, etc. The number of days to ship via Rail
or Over the Road (OTR) are in the first subform and in a different table,
from the second subform, as the second table holds shipment info related to
the main table. The purpose is to take the ship date and add however many
days as appropriate, which are different from different locations, and by
rail takes just forever! :)

So I try putting in this line in the Receive Date area on the form:

=IIf([ShipType]='OTR',[RecvDate]=[RecvDate]+[Forms]![Form-Main_Sub-LocationInfo].[OTR],[Forms]![Form-Main_Sub-LocationInfo].[Rail])

And it's fine until I try to use it. I have it use the On Enter event, so
it will react to the newly entered ship date, and get the error: "The
expression On Enter you entered as the event property setting produced the
following error: The object you referenced in the Visual Basic procedure as
an OLE object isn't an OLE object." It also changes the expression to:

=IIf([ShipType]='OTR',[RecvDate]=[RecvDate]+Forms![Form-Main_Sub-LocationInfo].OTR,Forms![Form-Main_Sub-LocationInfo].Rail)

Note that it took out a lot of the []'s. I also tried using double quotes
around the first OTR instead of apostrophes.

I've referenced another form's values before in another DV with no problem
by putting [Forms]![form name].[referenced field] and didn't have this as an
issue.

Does anyone have a possible correction for this, or another method? It
would be GREATLY appreciated.

Thanks!!
Steph
 
Try adding the main form to it like this --
=IIf([ShipType]='OTR',[RecvDate]=[RecvDate]+[Forms]![MainFormName]![Form-Main_Sub-LocationInfo].[OTR],[Forms]![MainFormName]![Form-Main_Sub-LocationInfo].[Rail])
 
Hi Karl,

Thanks for your reply! I tried what you suggested, and when I enter the
Receive Date are of my form (I have it set as On Enter), I get this error:

"The expression On Enter you entered as the event property setting produced
the following error: The object doesn't contain the automation object 'OTR.'.

And it changes the expression to (Why is it taking my brackets out like
that?):
=IIf([ShipType]='OTR',[RecvDate]=[RecvDate]+Forms![Form-Main]![Form-Main_Sub-LocationInfo].OTR,Forms![Form-Main]![Form-Main_Sub-LocationInfo].Rail)

So I get the idea that instead of just referencing the form, what you're
saying is to reference the main form, then the subform I'm trying to get
information from?

More thank you's in advance. :)
Steph

KARL DEWEY said:
Try adding the main form to it like this --
=IIf([ShipType]='OTR',[RecvDate]=[RecvDate]+[Forms]![MainFormName]![Form-Main_Sub-LocationInfo].[OTR],[Forms]![MainFormName]![Form-Main_Sub-LocationInfo].[Rail])


Luna Saisho said:
Hiya!

I'm trying to set something up to help one of our folks track our shipments,
and I would like it to look on another subform to see what's going on, but I
keep getting errors.

So basically, this form has two subforms. One to display contact
information for the plant we're shipping to as chosen by a combo box on the
main form, and another subform that lets him enter the specifics of that
shipment, PO #, ship date and type, etc. The number of days to ship via Rail
or Over the Road (OTR) are in the first subform and in a different table,
from the second subform, as the second table holds shipment info related to
the main table. The purpose is to take the ship date and add however many
days as appropriate, which are different from different locations, and by
rail takes just forever! :)

So I try putting in this line in the Receive Date area on the form:

=IIf([ShipType]='OTR',[RecvDate]=[RecvDate]+[Forms]![Form-Main_Sub-LocationInfo].[OTR],[Forms]![Form-Main_Sub-LocationInfo].[Rail])

And it's fine until I try to use it. I have it use the On Enter event, so
it will react to the newly entered ship date, and get the error: "The
expression On Enter you entered as the event property setting produced the
following error: The object you referenced in the Visual Basic procedure as
an OLE object isn't an OLE object." It also changes the expression to:

=IIf([ShipType]='OTR',[RecvDate]=[RecvDate]+Forms![Form-Main_Sub-LocationInfo].OTR,Forms![Form-Main_Sub-LocationInfo].Rail)

Note that it took out a lot of the []'s. I also tried using double quotes
around the first OTR instead of apostrophes.

I've referenced another form's values before in another DV with no problem
by putting [Forms]![form name].[referenced field] and didn't have this as an
issue.

Does anyone have a possible correction for this, or another method? It
would be GREATLY appreciated.

Thanks!!
Steph
 
Back
Top