Question:
how can I transfer my Report in Access to Excel using Visual basic 6.0 ( I don't have access installed)?
?
2010-07-13 20:15:03 UTC
How to transfer my report in mdb format to xls format using visual basic 6.0?


I've try this code but doesn't work


Private Sub Command38_Click()
Dim strExcelFile As String
Dim strWorksheet As String
Dim strDB As String
Dim strTable As String
Dim objDB As String

strExcelFile = "C:\Documents and Settings\admin\Desktop\scanned files\admintracker\Others.xls"
strWorksheet = "WorkSheet1"
strDB = "C:\Documents and Settings\admin\Desktop\scanned files\admintracker\Admintracker.mdb"
strTable = "MyTable"

Set objDB = OpenDatabase(strDB)

If Dir(strExcelFile) <> "" Then Kill strExcelFile

End If

objDB.Execute _
"SELECT * INTO [Excel 8.0;DATABASE=" & strExcelFile & _
"].[" & strWorksheet & "] FROM " & "[" & strTable & "]"
objDB.Close
Set objDB = Nothing
End Sub


My other question is... if I have access installed? Is this code will work with no errors?
Cause I got Error in

Set objDB = OpenDatabase(strDB)

please hep me!
Three answers:
anonymous
2010-07-13 20:22:33 UTC
You can transfer data to Excel, you can't transfer an Access report form. Use ADO. Look on (or ask, if you can't find it) http://www.vbforums.com/ for automating Excel, ADO and SQL help.
guilliams
2016-11-07 07:22:59 UTC
i might address this challenge any incorrect way around. rather of having get right of entry to attempt to export to Excel, i might have Excel import from get right of entry to. interior Excel, under the coaching menu, you need to have an selection for "Import exterior information" and then "New Database question". you need to use this option to create a link on your get right of entry to database and run the queries which will return the outcomes your desire. Embed a sort of queries on each and each of your worksheet tabs. as quickly as the queries are set up, you could refresh the outcomes with the clicking of a button.
me
2010-07-13 20:21:03 UTC
"How can I transfer my Report in Access to Excel using Visual basic 6.0 ( I don't have access installed)?"



how did you manage to get a report in access if its not installed?


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...