VB code based on different forms loaded

S

Simon

I have a Database that i use for taking ordes, the form is called
frmOrder

I have now created a very simply vertions of frmOrder called
frmOrderTill that is will be used in our shop ( does same stuff but
very basic

Hoever some of the subform replating to frmOrder and now frmORderTill,
have code in it that refers back to frmOrder, is there a way to write
the code so it can use either frmOrder or frmOrderTill depending on
what form is open

Example of code used
Forms![frmOrderProductAdd]![frmOrderProductTopBar].Form![OrderNumber]
= Forms![frmOrder]![OrderNumber]

i need a way to it will use either Forms![frmOrder]![OrderNumber] or
Forms![frmOrderTill]![OrderNumber]
 
L

Larry Linson

If these are truly Forms embedded in Subform Controls, which Subform
Controls are in both frmOrder and frmOrderTill, then you can refer back to a
control on the parent form with this code in the Form in the Subform
Control:

Me.Parent!<ControlName>

Some people (wrongly) use "subform" to refer to any form that is opened from
another form... this would not work for that case.

Larry Linson
Microsoft Office Access MVP
 

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