Error: Run time error 13 , Type mismatch

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • muddasirmunir
    Contributor
    • Jan 2007
    • 284

    #1

    Error: Run time error 13 , Type mismatch

    Please tell me what wrong in that code.

    I had many forms in MDI Child, which i want to adjust height and widht by the use of function. I had made the following function and put in in moudule at start


    Code:
    Public formname1 As Form
    Code:
    Public Function bigformalgfun(formname1 As Form)
    
    formname1.Left = Screen.Width - (Screen.Width - formname1.Width)
    formname1.Top = Screen.Height - (Screen.Height - formname1.Height) - ((Screen.Height - formname1.Height) / 3)
    formname1.Height = 6750
    formname1.Width = 10200
    
    End Function
    Now at the child form, the form name is crsale.frm i had called the funtion by

    Code:
    Private Sub Form_Activate()
    bigformalgfun (crsale)
    End Sub
    I am getting error

    Run time error 13 , Type mismatch
  • Guido Geurs
    Recognized Expert Contributor
    • Oct 2009
    • 767

    #2
    Why transfering a form?
    Just set and use the values like:
    Child with command1
    Code:
    Private Sub Command1_Click()
       With Me
          Call bigformalgfun(.WIDTH, .HEIGHT)
          .LEFT = FORM_LEFT
          .TOP = FORM_TOP
          .HEIGHT = FORM_HEIGHT
          .WIDTH = FORM_WIDTH
       End With
    End Sub
    Module with:
    Code:
    Public FORM_LEFT As Integer
    Public FORM_TOP As Integer
    Public FORM_HEIGHT As Integer
    Public FORM_WIDTH As Integer
    
    Public Sub bigformalgfun(FORMWIDTH As Integer, FORMHEIGHT As Integer)
       FORM_LEFT = Screen.WIDTH - (Screen.WIDTH - FORMWIDTH)
       FORM_TOP = Screen.HEIGHT - (Screen.HEIGHT - FORMHEIGHT) - ((Screen.HEIGHT - FORMHEIGHT) / 3)
       FORM_HEIGHT = 6750
       FORM_WIDTH = 10200
    End Sub

    Comment

    Working...