0

我的数据库在我的电脑上,当我打开应用程序时出现运行时错误 3033。

在启动时,我配置了 2 个事件,On Load 和 On Current。

On Load 通过附加从一个表(链接的 Outlook 表)中获取信息并放入另一个表中。On Current 检查现有记录的匹配和循环。

我的猜测是,当另一个事件触发或它们相互冲突时,表单可能需要时间来初始化。

随着我不断开发我的应用程序,错误来来往往。我想摆脱这个错误。

见下面的代码:

Private Sub Form_Current()
Dim closingdate As Date
Dim closingemail As String
Dim Status As String
Dim rs As DAO.Recordset
Dim intI As Integer
Dim ticket As String
Dim subj As String

On Error GoTo ErrorHandler
Set rs = CurrentDb.OpenRecordset("show on")

Command23.Enabled = True
subj = [subject]
closingdate = [Date]
closingemail = [email]
testemail = closingemail
testdate = closingdate
filedatecheck = [Date]
'Check to see if the recordset actually contains rows
If Not (rs.EOF And rs.BOF) Then
    rs.MoveFirst 'Unnecessary in this case, but still a good habit
    Do Until rs.EOF = True
                  'If rs![tkt] Like "*[!A-Z]" & subj & "[!A-Z]*" Then ticket = rs![tkt]: Me.Command109.Enabled = True: DoCmd.OpenForm "Closing", acNormal, WindowMode:=acDialog, WhereCondition:=ticket & Me.[tkt]: Me.[closing Date] = closingdate: Me.[Remarks (Date in one cell and Text in next cell)] = closingemail
                    If subj Like "*" & rs![tkt] & "*" Then ticket = rs![tkt]: DoCmd.OpenForm "Closing", acNormal, WindowMode:=acDialog, WhereCondition:="[tkt]=" & "'" & ticket & "'": Me.[closing Date] = closingdate: Me.[Remarks (Date in one cell and Text in next cell)] = closingemail: Me.[Status] = updatestatus
                  'Move to the next record. Don't ever forget to do this.
                  Me.Requery
         rs.MoveNext
    Loop
Else
   ' MsgBox "There are no records in the recordset."
End If
'MsgBox "Finished looping through records."

rs.Close 'Close the recordset
Set rs = Nothing 'Clean up

ErrorHandler:
   'MsgBox Err & ": " & Err.Description
End Sub
Private Sub Form_Load()
Call GetAttachments
DoCmd.SetWarnings False
DoCmd.OpenQuery "cs Query Append", acViewNormal, acEdit
DoCmd.OpenQuery "cs Query Delete", acViewNormal, acEdit
DoCmd.SetWarnings True
Form.Requery
End Sub
Private Sub Form_Current()
Dim closingdate As Date
Dim closingemail As String
Dim Status As String
Dim rs As DAO.Recordset
Dim intI As Integer
Dim ticket As String
Dim subj As String

On Error GoTo ErrorHandler
Set rs = CurrentDb.OpenRecordset("show on")

Command23.Enabled = True
subj = [subject]
closingdate = [Date]
closingemail = [email]
testemail = closingemail
testdate = closingdate
filedatecheck = [Date]
'Check to see if the recordset actually contains rows
If Not (rs.EOF And rs.BOF) Then
    rs.MoveFirst 'Unnecessary in this case, but still a good habit
    Do Until rs.EOF = True
                  'If rs![tkt] Like "*[!A-Z]" & subj & "[!A-Z]*" Then ticket = rs![tkt]: Me.Command109.Enabled = True: DoCmd.OpenForm "Closing", acNormal, WindowMode:=acDialog, WhereCondition:=ticket & Me.[tkt]: Me.[closing Date] = closingdate: Me.[Remarks (Date in one cell and Text in next cell)] = closingemail
                    If subj Like "*" & rs![tkt] & "*" Then ticket = rs![tkt]: DoCmd.OpenForm "Closing", acNormal, WindowMode:=acDialog, WhereCondition:="[tkt]=" & "'" & ticket & "'": Me.[closing Date] = closingdate: Me.[Remarks (Date in one cell and Text in next cell)] = closingemail: Me.[Status] = updatestatus
                  'Move to the next record. Don't ever forget to do this.
                  Me.Requery
         rs.MoveNext
    Loop
Else
   ' MsgBox "There are no records in the recordset."
End If
'MsgBox "Finished looping through records."

rs.Close 'Close the recordset
Set rs = Nothing 'Clean up

ErrorHandler:
   'MsgBox Err & ": " & Err.Description
End Sub
Private Sub Form_Load()
Call GetAttachments
DoCmd.SetWarnings False
***DoCmd.OpenQuery "cs Query Append", acViewNormal, acEdit***
DoCmd.OpenQuery "cs Query Delete", acViewNormal, acEdit
DoCmd.SetWarnings True
Form.Requery
End Sub
enter code here

这是sql查询和代码中的上述粗体行:INSERT INTO master(优先级,主题,请求者,抄送,电子邮件,[有附件],[日期],部门,[办公电话(交换数据)],建筑) SELECT cs.Priority, cs.Subject, cs.From, cs.CC, cs.Contents, cs.[有附件], cs.Received, [用户名].Department, [用户名].Phone, [用户名] .Office FROM cs, [用户名] WHERE (((cs.From)=[用户名].[显示名]));

4

0 回答 0