gpt4 book ai didi

forms - Access vba DoCmd.OpenForm "Action was canceled"

转载 作者:行者123 更新时间:2023-12-02 05:05:27 25 4
gpt4 key购买 nike

Private Sub OccurrenceName_AfterUpdate()
If OccurrenceName.Value = "Other" Then
Dim strTechID As String
Dim strOccurrenceCt As String
Dim strOccurrenceDate As String

strTechID = Me.Parent.tbxTechID.Value
strOccurrenceCt = Forms![frmEmployeeOccurrenceInput]![tbxOccurrence].Value
strOccurrenceDate = Me.OccurrenceDate.Value

Dim strOpenArgs As String
strOpenArgs = strTechID & "|" & strOccurrenceCt & "|" & strOccurrenceDate

DoCmd.OpenForm "frmOtherOccurrence", , , , , , strOpenArgs
Else
Me.OccurrenceAmt = Me.OccurrenceName.Column(1)
Me.Type = Me.OccurrenceName.Column(2)
End If
End Sub

每次它运行时,我都会收到错误代码 2501 的“打开表单操作被取消”。它被捕获的行是 DoCmd.OpenForm 调用。调试不提供额外信息。

这里是 OpenArgs 传递给的地方:

Private Sub Form_Load()

Dim aryOA As Variant

aryOA = Split(Me.OpenArgs, "|")

Me.lblTechID.Caption = aryOA(0)
Me.lblOccurrenceCt.Caption = aryOA(1)
Me.lblOccurrenceDate.Caption = aryOA(2)

End Sub

最佳答案

我不知道这是否是你的问题,但你不能将 OpenArgs 传递给打开的表单,打开我的意思是它甚至不能处于编辑模式,应该完全关闭。

否则,表单将打开(将其状态从编辑模式更改为正常)但不会传递任何 OpenArgs,因此 OpenArgs 将为 null 并抛出异常。

关于forms - Access vba DoCmd.OpenForm "Action was canceled",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12204147/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com