Same Command Button for two different forms?

ath23

Registered User.
Local time
Today, 12:20
Joined
Jan 14, 2001
Messages
12
Hi Guys,

Probably easy question:....I have two separate forms at the moment Search 1 and Search 2. On double click on both forms, it can take the user to the selected record. However, I want to create one command button that takes them back to either Search 1 or Search 2, depending which one they are in..
Not sure what to do ..I can capable of only moving the user back to one specific one...but not Search 1 and 2 attached to one command button..

Pls help..thanks a million
 
I think what you need to do is set up a global variable to hold the search forms name such as:

Dim strWhichForm as string

Then on clicking the CommandButton on search form 1 set the global variable to equal the form name. Put the same code in search form 2.

Btn_Click
strWhichForm = Me.Name
docmd.open "YourRecordForm",,YourFilter

On the button on the record form set it's code to:

Docmd.OpenForm strWhichForm

I think that should work, please let me know if it does(or doesn't)...

Ian
 

Users who are viewing this thread

Back
Top Bottom