Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export

Status
Not open for further replies.

rjoshi2

Programmer
Sep 10, 2002
110
US

Why is my code not working? It does not export the object if one exists with the same name. How can I get my export the replace the object if it already exists? Any help would be appreciated.

Thank you
rjoshi2

Dim SourceDestin As String
SourceDestin = ObjType & "/" & OutputType
Select Case SourceDestin
Case "Form/Microsoft Access"
DoCmd.TransferDatabase acExport, OutputType, _
Folder, acForm, ObjName, ObjName, False
Case "Query/Microsoft Access"
DoCmd.TransferDatabase acExport, OutputType, _
Folder, acQuery, ObjName, ObjName, False
Case "Report/Microsoft Access"
DoCmd.TransferDatabase acExport, OutputType, _
Folder, acReport, ObjName, ObjName, False
Case "Table/Microsoft Access"
DoCmd.TransferDatabase acExport, OutputType, _
Folder, acTable, ObjName, ObjName, False
Case "Module/Microsoft Access"
DoCmd.TransferDatabase acExport, OutputType, _
Folder, acModule, ObjName, ObjName, False
Case "Macro/Microsoft Access"
DoCmd.TransferDatabase acExport, OutputType, _
Folder, acMacro, ObjName, ObjName, False
Case "Query/Excel 97-2002"
DoCmd.TransferSpreadsheet acExport, 8, ObjName, _
Folder & "\" & ObjName & ".xls", False, ""
Case "Table/Excel 97-2002"
DoCmd.TransferSpreadsheet acExport, 8, ObjName, _
Folder & "\" & ObjName & ".xls", False, ""
Case "Report/Excel 97-2002"
DoCmd.OutputTo acReport, ObjName, "MicrosoftExcelBiff8(*.xls)", _
Folder & "\" & ObjName & ".xls", False
Case "Query/HTML"
DoCmd.OutputTo acQuery, ObjName, "HTML(*.html)", _
Folder & "\" & ObjName & ".html", False, "", 0
Case "Report/HTML"
DoCmd.OutputTo acReport, ObjName, "HTML(*.html)", _
Folder & "\" & ObjName & ".html", False, "", 0
Case "Table/HTML"
DoCmd.OutputTo acTable, ObjName, "HTML(*.html)", _
Folder & "\" & ObjName & ".html", False, "", 0
Case "Report/Rich Text Format"
DoCmd.OutputTo acReport, ObjName, "RichTextFormat(*.rtf)", _
Folder & "\" & ObjName & ".rtf", False, "", 0
Case "Query/Text"
DoCmd.OutputTo acQuery, ObjName, "MS-DOSText(*.txt)", _
Folder & "\" & ObjName & ".txt", False, "", 0
Case "Report/Text"
DoCmd.OutputTo acReport, ObjName, "MS-DOSText(*.txt)", _
Folder & "\" & ObjName & ".txt", False, "", 0
Case "Table/Text"
DoCmd.OutputTo acTable, ObjName, "MS-DOSText(*.txt)", _
Folder & "\" & ObjName & ".txt", False, "", 0
Case Else
MsgBox "Either your ObjectList table is missing or " _
& vbCr & "your output type is not selected."
End Select

 
You could try this:
DoCmd.SetWarnings False

remember to set warnings back to true after your code

Rgds
Herman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top