我有两种形式。第一个表单具有文本字段,用户应先填写文本字段,然后再继续填写下一个表单。下面是我的代码。该代码给我一个错误。每当我单击命令按钮以关闭表格1并开始表格2时。
如果用户表格1中的字段未填写,则不应将用户带到表格2。
Private Sub NexFinInfo_Click()
If CLN.Text = "" Then
MsgBox ("Company Legal Name is a mandatory field!")
Else
Range("A2").Value = CLN.Text
End If
If BRL.Text = "" Then
MsgBox ("Business Registration/ License is a mandatory field!")
Else
Range("B2").Value = BRL.Text
End If
If COA.Text = "" Then
MsgBox ("Company Address is a mandatory field!")
Else
Range("C2").Value = COA.Text
End If
Range("D2").Value = PON.Text
Range("E2").Value = TNR.Text
If BLA.Text = "" Then
MsgBox ("Billing Address is a mandatory field!")
Else
Range("F2").Value = BLA.Text
End If
If Range("A2:C3", "F2").Value = "" And Then
MsgBox ("All the fields marked with * in the form are mandatory")
Else
Unload Me
FININFO.Show
End If
End Sub