-
Public Sub gets(pCity As String, pWeek As Byte)
-
'export function
-
'Exports tables in access database to Excel
-
'Referenec to DAO is required
-
Dim strExcelFile As String
-
Dim strWorksheet As String
-
Dim strDB As String
-
Dim strTable As String
-
Dim strTable1 As String
-
Dim strTable2 As String
-
Dim strTable3 As String
-
Dim strTable4 As String
-
Dim strTable5 As String
-
Dim strTable6 As String
-
Dim objDB As Database
-
Dim outputFileName As String
-
-
'Change Based on your needs or use parameters as sub
-
strExcelFile = "C:\Documents and Settings\velal\My Documents\Book1.xls"
-
strWorksheet = "Council"
-
strDB = "C:\Documents and Settings\My Documents\Completed.mdb"
-
strTable = "stud"
-
strTable1 = "attendance"
-
strTable2 = "marks"
-
strTable3 = "fee"
-
strTable4 = "course"
-
strTable5 = "subject"
-
strTable6 = "PD"
-
Set objDB = OpenDatabase(strDB)
-
'If excel file already exist you can delete it here
-
If Dir(strExcelFile) <> "" Then Kill strExcelFile
-
objDB.Execute ("SELECT * INTO [Excel 8.0; DATABASE=" & _
-
strExcelFile & "].[" & strWorksheet & "] FROM " & "[" & strTable & "]" & _
-
"WHERE city = '" & pCity & "' AND [Week Periodtext] = " & pWeek)
-
outputFileName = "C:\Documents and Settings\velal\My Documents\Book1.xls"
-
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "stud", outputFileName, True
-
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "attendance", outputFileName, True
-
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "marks", outputFileName, True
-
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "fee", outputFileName, True
-
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "course", outputFileName, True
-
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "subject", outputFileName, True
-
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "PD", outputFileName, True
-
objDB.Close
-
Set objDB = Nothing
-
End Sub
-
' Start here with parameters provided
-
Public Sub start()
-
Call gets("Brisbane", 5)
-
End Sub
-
2 1420
Vanessa
You haven't actually asked a question, just posted a load of code. Where exactly are you having a problem? What part of your code does not work?
Mary
hi mary,
With th ecode i'm having i can import all the seven tables into seven spreadsheets of the same workbook. But now i want to make all the seven spreadsheets into one spreadsheet with all the tables in 2 columns and 3 rows. Is that possible
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Edward S |
last post by:
I budget for a Project in an Excel sheet as illustrated below. The
months below are usually a 2 year period i.e. 24 months, though it
could be over 24 months depending upon a Project. I then...
|
by: Eddy |
last post by:
I would like to export the output of 2 queries to excel namely:
1. QryProrationbyWBS_1
2. QryProrationbyWBS_2
However I want to do this using the same spreadsheet say sheet1 and
sheet2 or...
|
by: Sachin Salgarkar |
last post by:
I have a DataSet that I need to export to Excel.
The dataset has multiple tables. I need a way to export the complete dataset
to a single Excel Workbook with sheets for each table in the dataset....
|
by: VitorCastro |
last post by:
Hello...
First, sorry for my bad english...
i have generated many pivot tables in Access 2003. and i want the code to export all of them to one single excel sheet and specific cell.
i have...
|
by: Chris Gilpin |
last post by:
Hey everybody.
I have Access set up using VBA to run a bunch of queries automatically, and then export the results into Excel. The only problem is, I want each query to be exported to the same...
|
by: gmujjain4902 |
last post by:
Hi,
Please help me with code for
to Export HTML table to Excel sheet using javascript without using ActiveX controls...
The problem is i could get solution for my problem via ActiveX control...
|
by: hotflash |
last post by:
Hi All,
Instead of displaying the search results such as names, phones, etc... on the screen, is there a way to export this information into an EXCEL format using ASP?
Please advise. Thanks...
|
by: Blacky |
last post by:
hi,
I have a dataTable in Session.On the click of a button in a Modal Dialog window I need to export this dataTable to Excel sheet.How could i do this...??
i tried using a...
|
by: RajeshPune |
last post by:
We are deveopingawebiste in asp.net. There are tempelates of each aspx page made in the form of excel sheet. Upon completion of the online calculation, the user is to be allowed to export the results...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |