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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I tell which control I am coming from

Status
Not open for further replies.

OldSlowDog

Programmer
Mar 11, 2002
36
US
Help please help.
I have a custom menu bar "HardwareMenu".

Orders Vendor
New New
Update Update
Search

Both the Order Update and Order Search use the same screen. I am thinking to pass something into the Form_Load() so I can tell where it is coming from and enable or disable certain fields on screen.

How can I pass something to the form after the user clicks an item on the "HardwareMenu"?

Thanks.
 
You can use OpenArgs, which is the final argument of DoCmd.Openform
 
How are ya OldSlowDog . . .

In the last arguement of DoCmd.OpenForm (OpenArgs) pass update or search:
Code:
[blue]   DoCmd.OpenForm "[purple][b][i]FormName[/i][/b][/purple]", , , , , , "[b]Update[/b]"
or
   DoCmd.OpenForm "[purple][b][i]FormName[/i][/b][/purple]", , , , , , "[b]Search[/b]"[/blue]
Then in the forms [blue]On Load[/blue] event:
Code:
[blue]   If me.OpenArgs = "Update" Then
      [green]'Code for Update[/green]
   Else
      [green]'Code for Search[/green]
   End If[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
Thank you the helping.
However, since the user has to click a menu item first before I can use the OPENFORM command, how do I know whether he clicked Update or Search on the menu bar?


Thanks.
 
What are you using in the menu? Have you a function assigned to On Action?
 
OldSlowDog . . .

Just add an arguement to the function to carry the descriptor.
Code:
[blue]Public YourFunctionName(Descript as string)[/blue]
Then it the On Action of the button:
[code[blue]=YourFunctionName("Update")[/blue][/code]

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top