Parse variable to function reports as mouse event [Solved]

I am attempting to call a subroutine as below. If I watch the variable “Number” in the OpenFormImage routine it reports as a mouse event
The sub openMainImage is called by a “Mouse button released” event on a button in the main form. As there are several images on the main form I am attempting to make the OpenFormImage event as generic as possible hence the call to the subroutine.
Begs the question. What am I doing wrong?
The original Sub OpenFormImage before setting it up as a called routine works flawlessly. It is only, now that I attempting to validate the input from the calling routine that I run into strife.

Sub openMainImage
End Sub

Sub openVariantImage

Sub OpenFormImage(Number)
  Dim oForm     'Reference to the form containing the primary record.
  Dim oSubForm  'Reference to the subform containing the data
  REM Get the button's view model from the event Source.
  REM Get the button's data model from the view model.
  REM Get the form from the data model.
   		oForm = ThisComponent.DrawPage.Forms.getByIndex(0)    ' Main Form
  	 	oSubForm = oForm.GetByName("Stamp")              ' SubForm Name
  Dim sSG	 	
  Dim lSG
    REM Find the column that contains the NAME field.
 If Number = 3 then  
    lSG = oSubForm.findColumn("SM_VARIANT")
 Elseif Number= 2  then
    lSG = oSubForm.findColumn("SM_WATERMARK")
    lSG = oSubForm.findColumn("SM_IMAGE")   
 End If        
  REM Get the data for the current record.
    sSG = oSubForm.getString(lSG)  
	sSG = "/home/leigh/Documents/Stamps/" & sSG
 REM Open the window
	Shell "pix " & sSG

End Sub

Ignore this, there was nothing wrong with it, I set the wrong click event on the button. My own fault.