|
为什么以下代码使用ACCESS快捷键筛选后仍要全部导出,子窗体未邦定
If Me.框架0 <= 7 Then
ab = "D:\Mymis\XLS\制成率分析.xls"
ElseIf Me.框架0 = 8 Or Me.框架0 = 9 Then
ab = "D:\Mymis\XLS\直通率分析.xls"
ElseIf Me.框架0 = 188 Then
ab = "D:\Mymis\XLS\芯包成本分析.xls"
End If
If Me.框架0 <= 7 Then
ac = "决策中心制成率"
ElseIf Me.框架0 = 8 Or Me.框架0 = 9 Then
ac = "一次性合格率"
ElseIf Me.框架0 = 188 Then
ac = "成本芯包"
End If
Dim oApp As Object
Dim oappwork As Excel.Workbook, oappwork_sheet1 As Excel.Worksheet
Set oApp = CreateObject("Excel.Application")
oApp.Visible = False
Set oappwork = oApp.Workbooks.Open(ab)
Set oappwork_sheet1 = oappwork.Worksheets("sheet1")
oappwork_sheet1.cells(1, 1) = DLookup("[gsmc]", "tabcompanyinfo")
Me.cr.SourceObject = ac,好像是这句,重新执行了查询,将原来的筛选去掉了
Set Me.Recordset = Forms!Form1.Recordset
With Me.cr.Form.Recordset
.MoveFirst
nn = .Fields.count
j = 5
Do
If .EOF Then
Exit Do
Else
For i = 1 To nn - 1
oappwork_sheet1.cells(j, 0 + i) = .Fields(i)
Next i
j = j + 1
.MoveNext
End If
Loop
MsgBox "已形成报表,请确认后打印!", vbInformation, "MIS"
oApp.Visible = True
End With
On Error Resume Next
oApp.UserControl = True |
|