附加表时出现错误3033

时间:2013-10-23 06:14:14

标签: ms-access runtime-error

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

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

On Load通过append从一个表(链接的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(优先级,主题,请求者,CC,电子邮件,[有附件],[日期],部门,[办公室电话(Exch数据)],建筑物) SELECT cs.Priority,cs.Subject,cs.From,cs.CC,cs.Contents,cs。[Has Attachments],cs.Received,[User Names] .Department,[User Names] .Phone,[User Names] 。办公室 FROM cs,[用户名] WHERE(((cs.From)= [用户名]。[显示名称]));

0 个答案:

没有答案