繁体   English   中英

MSAccess-无效使用属性?

[英]MSAccess - Invalid use of property?

我在表单上有一个按钮,该按钮从位于MainForm上的子表单数据表中获取所选列的值(SFDC_InventoryID)。 SFDC_InventoryID是文本字符串。

当我尝试将此值传递给函数(称为“ SFDC”)时,看到“无效使用属性”错误。 VB从未发挥作用。

在下面的代码段中,msgbox确实显示了预期的字符串值。 当我指向MainForm本身上的简单文本框控件时,看不到相同的错误。

有什么建议可以纠正吗?

Private Sub btnSFDCInventory_Click()

    'MsgBox just to test...
    MsgBox Forms!mainform!InventoryList_subform.Form!SFDC_InventoryID

    If Nz(Trim(Forms!mainform!InventoryList_subform.Form!SFDC_InventoryID)) = 0 Then
        MsgBox "No SFDC InventoryID to Display"
    Else
        SFDC Forms!mainform!InventoryList_subform.Form!SFDC_InventoryID  '<< this line throws the error
    End If

End Sub

调用此函数:

Public Function SFDC(SFDC_ID As String)

Dim strSFDC As String

    strSFDC = "https://na79.salesforce.com/" & SFDC_ID

    Application.FollowHyperlink strSFDC

End Function

尝试这个

If Nz(Trim(Forms!mainform!InventoryList_subform.Form!SFDC_InventoryID),"") = "" Then
   MsgBox "No SFDC InventoryID to Display"
Else
   SFDC Forms!mainform!InventoryList_subform.Form!SFDC_InventoryID  
End If

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM