我有一个正在构建的 Access 数据库。我的 VB 教育是我需要定制数据库的点点滴滴,而不是 Access 所做的,所以它非常参差不齐。我有一个按钮,按下时会运行以下代码。代码工作正常。问题是当我进入 VB 屏幕并在 Debug 菜单下进行 Compile 时,我收到一条错误消息,指出“编译错误:属性的无效使用”。
' Memo Line Button Script
Private Sub Memo_Line_Click()
On Error GoTo Memo_Line_Click_Err
If Me.Dirty Then Me.Dirty = False
Memo_Line ([Forms]![Logform]![HLCtrl]) 'error highlights ![HLCtrl]
Memo_Line_Click_Exit:
Exit Sub
Memo_Line_Click_Err:
MsgBox Error$
Resume Memo_Line_Click_Exit
End Sub
Memo_Line 指的是一个公共函数。该代码在下面列出。
' Copy Offer Memo Line Data to Clipboard Button Script
Public Function Memo_Line(HLC)
On Error GoTo Memo_Line_Click_Err
DoCmd.OpenForm "Log-Memo Line", acNormal, "", "[HL#]=" & "'" & HLC & "'", , acNormal
Call ClipBoard_SetData([Forms]![Log-Memo Line]![Memo])
MsgBox ([Form_Log-Memo Line].[Memo] & " --- copied to Clipboard."), vbInformation, "Clipboard Details"
DoCmd.Close acForm, "Log-Memo Line"
Memo_Line_Click_Exit:
Exit Function
Memo_Line_Click_Err:
MsgBox Error$
Resume Memo_Line_Click_Exit
End Function