Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,616
- Office Version
- 365
- 2016
- Platform
- 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.
Here is module services_add:
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