The below code give me a compile Error : Arugement not optional on EMptyboth FrmPoliCreate. I know it is my coding problem how do i solve this?
I have another problem is I have to call EmptyWs in mskNCD textbox but would like to SetFocus on txtSumInsured textbox Until TxtSumInsured is True.
If i Include txtSumInsured.SetFocus The cursor will goes off to textbox1 where i click on the textbox1 even the condition iS TRUE.
VB Code:
'This is in the Module. Public Sub EMptyWS(FormName As Form, Cancel As Boolean) If Len(FormName.txtSumInsured.Text) = 0 Then MsgBox "Please enter a Sum Insured amount first", vbExclamation, "Wind Screen" Else FormName.txtWs.Text = CDbl(FormName.txtperWs.Text) * CDbl(FormName.txtSumInsured.Text) / 100 KeepFocus = True End If End Sub 'This is in the Form Private Sub mskNCD_Validate(Cancel As Boolean) EMptyWs FrmPoliCreate ' Arugement Not Optional ??? End Sub
The reason that i implement in module and call in form because i have many forms which need this code.
thank you in at advance




Reply With Quote