强制用户在填充文本框之前填充超链接
Force user to populate hyperlink prior to populating a text box
我目前正在改进一个相当陈旧的任务订单数据库,我正在尝试进行的一项功能改进是强制用户在选择任务日期之前在表单上设置超链接值标记为完成。
我对 vba 非常陌生,顺便说一句。
FEDel 是我的日期选择器文本框。
FSDel 是我的日期选择器的控制源。
FDLink 是我的超链接文本框。
LinkToFieldDel 是我的超链接控制源。
Private Sub FEDel_Click()
If LinkToFieldDel = Null Then Msgbox("Please set the Field Deliverables File Path before entering a Delivery Date!", vbCritical, "Field Deliverables File Path Not Set!", "Use the 'Link to File Deliverables' button below to set the file path.") As VbMsgBoxResult
Exit Sub
Else
End Sub
我一直在 LinkToFieldDel 上收到 "Compile Error: Statement invalid outside Type block",我很困惑为什么会这样。
我愿意接受任何其他关于如何使这种情况也有效的建议,这正是我有限的经验想到的。谢谢!
无法编译的原因有几个
- 您要么必须在另一行上使用 THEN 并关闭 IF
在 ELSE 之后阻塞 - 或删除 ELSE
- 你还应该删除
As VbMsgBoxResult
- 你调用的函数没有声明子
- 删除它,除非你在某处有帮助文件"Use the 'Link to File Deliverables' button below to set the file path."
此外 - 使用 IsNull() 或 NZ() 函数进行比较可能是更好的主意
Private Sub FEDel_Click()
If IsNull(LinkToFieldDel) Then
Msgbox "Please set the Field Deliverables File Path before entering a Delivery Date!", vbCritical, "Field Deliverable File Path Not Set!"
Exit Sub
Else
' Do something else here
End If
End Sub
我目前正在改进一个相当陈旧的任务订单数据库,我正在尝试进行的一项功能改进是强制用户在选择任务日期之前在表单上设置超链接值标记为完成。
我对 vba 非常陌生,顺便说一句。
FEDel 是我的日期选择器文本框。
FSDel 是我的日期选择器的控制源。
FDLink 是我的超链接文本框。
LinkToFieldDel 是我的超链接控制源。
Private Sub FEDel_Click()
If LinkToFieldDel = Null Then Msgbox("Please set the Field Deliverables File Path before entering a Delivery Date!", vbCritical, "Field Deliverables File Path Not Set!", "Use the 'Link to File Deliverables' button below to set the file path.") As VbMsgBoxResult
Exit Sub
Else
End Sub
我一直在 LinkToFieldDel 上收到 "Compile Error: Statement invalid outside Type block",我很困惑为什么会这样。
我愿意接受任何其他关于如何使这种情况也有效的建议,这正是我有限的经验想到的。谢谢!
无法编译的原因有几个
- 您要么必须在另一行上使用 THEN 并关闭 IF 在 ELSE 之后阻塞 - 或删除 ELSE
- 你还应该删除
As VbMsgBoxResult
- 你调用的函数没有声明子 - 删除它,除非你在某处有帮助文件"Use the 'Link to File Deliverables' button below to set the file path."
此外 - 使用 IsNull() 或 NZ() 函数进行比较可能是更好的主意
Private Sub FEDel_Click()
If IsNull(LinkToFieldDel) Then
Msgbox "Please set the Field Deliverables File Path before entering a Delivery Date!", vbCritical, "Field Deliverable File Path Not Set!"
Exit Sub
Else
' Do something else here
End If
End Sub