Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting a value in form 1 from form 2 where form 1 opened form 2

Status
Not open for further replies.

astraltango

Programmer
Joined
Nov 19, 2003
Messages
18
Location
AU
In some of my forms, I wish to select a customer.

The way I have implemented this is, I have a button on the original form, to open up another form which displays a list of customers to choose from.

What I want, is for the user to be able to select the appropriate customer which updates the original form with the CustomerId.

The problem lies in the fact that the customer selection form needs to update one of many calling forms (ie, there will be multiple forms using the customer selection form).

How can I determine the calling form so I can update it with with selected CustomerId? Is it possible to use global variables to record the calling form?

Cheers
 
Hi,

I would use the openargs argument of the openform method to determine which form had opened the customer selection form. So for example:

I have form1, form2, form3, form4 all which can open the customer selection form. Depending upon the form I'm opening the customer form from I would include a different value for openargs.

so assuming I'm opening from form1,
docmd.openform "Customer",,,,,1
etc etc...

then in the Customer selection form, once the user has selected their customer, use a select case with the openargs property.

So
select case me.openargs
case 1:
update form1
case 2:
update form2
etc.
end select

That would be a simple way to do it that I can think of.

Let me know if this helps,
James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top