ByRef Argument Type Mismatch Passing Variable

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,570
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am getting a "ByRef Argument type mismatch" error with this code (the code highlighted in red) in which I am trying to pass a variable (bypass_updatefrm) value between a userform module (cbt_s1_add_Click) and a standard module (services_add). Hoping someone can help me overcome this error.

Rich (BB code):
Private Sub cbt_s1_add_Click()
    Dim bypass_updatefrm As Boolean
    Me.cbt_s1_add.Enabled = False
    Me.btn_help.Visible = False
    Me.cbt_s1_del.Visible = True
Stop
    If trnfrm_new = True Then
        'Stop
        'itrnsvc_add Me, 1 '(proceduree, uf:frmservice, index)
        bypass_updatefrm = False
        If ss = True Then
            index = 1
            services_add bypass_updatefrm
        Else
            services_add bypass_updatefrm
        End If
    Else
        Stop
        'btrnsvc_add Me, 1 '(proceduree, uf:frmservice, index)
        index = 1
        services_add bypass_updatefrm
    End If
End Sub

Here is module services_add:

Code:
Sub services_add(ByRef index As Long, bypass_updatefrm As Boolean)

    Dim vcolor As Long
    Dim bypass_overlap As Boolean
    Dim bypass_del As Boolean
    
    Application.ScreenUpdating = False
    escf = 0
    'check to ensure all service data has been entered
    trn_srv_datachk 'index
    
    'create thold services reference
    vcolor = vbGreen
    bypass_overlap = False
    bypass_del = False
    
    trn_srv_working vcolor, bypass_overlap, bypass_del '{this module}
    
    If escf = 1 Then Exit Sub
    
    'populate coredata (all service update)
    trn_srv_coredata
    
    'update master pda booking range (M:P)
    trn_srv_bkgrng

    'update master pda service range
    ws_master.Activate
    trn_srv_svcrng

    'update userform based on sort (align by time)

        trn_srv_alignform frmservice
        srvsnum = index + 1
        index = index + 1
        trn_resize srvsnum
        trnframe_reset ' index
        frmservice.Controls("frm_service" & index).Visible = True
        frmservice.Controls("cbt_s" & index - 1 & "_del").Enabled = True
        Application.ScreenUpdating = True
        
        ss = True 'reset index

End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
The services_add procedure is expecting two values not one & the first should be a Long data type & you are passing it a boolean.
 
Upvote 0
Solution
Oh, I see. Thanks Fluff. That was easy.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top