Source

  • Thread starter Thread starter p_munny
  • Start date Start date
P

p_munny

Hi,
I have two forms. One form opens up as a popup from other form. In 1st form
I have two buttons and these two button open up the 2nd form. My problem is
when I click on the first button I want to show the different image then 2nd
button. Is there a way to pass information about which button was clicked to
get to the second form?

Thanks,
MP
 
Use the OpenArgs when you call the form.

Exemple :

Open the Form

Dim stDocName As String 'Will contain the form name that will be open
Dim ctrl As String 'Will contain the arguments we want to pass to the form

ctrl = Me.Name & "*" & Me.ButtonName.Name 'Assigne form name and control
name separate by a "*"
stDocName = "YourForm" 'Assigne form name to open

DoCmd.OpenForm stDocName, , , , , , ctrl 'Open form

In the Form_Load Event of the newly open form the retreive the info

Dim Sep As Integer 'Will contain the string separator
Dim frm As String 'Will contain the parent form name
Dim ctl As String 'Will contain the parent control

'Etract info from Open Arguments
Sep = InStr(1, OpenArgs, "*")
frm = Left(OpenArgs, Sep - 1)
ctl = Right(OpenArgs, Len(OpenArgs) - Sep)

Hope it will help.
 
Back
Top