Hi All,
Iam new to access
Can some one pls help me pls..
My database is :- Access
I connect to my database using ODBC using oracle RDB driver.
I have a watchlist.mdb file. Which has almost 120 queries in it, evryday we use to run these queries and export to excel and send it users. It will take 2 1/2 hrs to complete this task. Can someone pls help me to find some solution. So i can stop this by doing manually 14 2208
I guess you need to iterate CurrentDb.QueryDefs collection calling DoCmd.TransferSpreadsheet for each query in the collection.
Regards,
Fish.
Hi Fish,
Thanks for replay ...
Could you pls shed some light how to proceed as this is supposed to done by the end of this week... it will be realy helpful if you help in this...
Cheer's
Harsha
harshakusam,
It seems FishVal's post is quite self - explanatory (as his posts usually are). Here is how to execute it, I may have missed something because it seems you are an IT professional so would be more experienced then me, but here goes:
Create a Form in Access with a button with the following on click event: - Private Sub cmdExport120Queries_Click()
-
DoCmd.TransferSpreadsheet acExport, "Type in the spreadsheet type", "Name of The First Query You Want To Export", "Destination Where you want to spreadsheet to be created", "Does the Query have field names"
-
DoCmd.TransferSpreadsheet acExport, "Type in the spreadsheet type", "Name of The Second Query You Want To Export", "Destination Where you want to spreadsheet to be created", "Does the Query have field names"
-
'...and so on
-
End Sub
-
@harshakusam
Something like the following: -
Public Sub ExportAllQueriesToXLS()
-
-
Dim db As DAO.Database
-
Dim qry As DAO.QueryDef
-
-
Set db = CurrentDb
-
-
For Each qry In db.QueryDefs
-
DoCmd.TransferSpreadsheet acExport, , qry.Name, "X:\Export\" & qry.Name
-
Next
-
-
Set qry = Nothing
-
Set db = Nothing
-
-
End Sub
-
NeoPa 32,556
Expert Mod 16PB @iheartvba
I think Fish's method was intended to indicate the use of the For...Each loop in fact (although any attempt to help is always appreciated). - Private Sub cmdExportAllQueries_Click()
-
Dim qdf As DAO.QueryDef
-
-
For Each qdf In CurrentDb.QueryDefs
-
Call DoCmd.TransferSpreadsheet(TransferType:=acExport, _
-
TableName:=qdf.Name, _
-
FileName:=qdf.Name & ".Xls", _
-
HasFieldNames:=True)
-
Next
-
End Sub
Hi Neopa,
Does above code will work..
Shoould run all my quries 1 by one and export the output to excel and save it in particular location.
Below is the code i use
--------------------------------------- - Public Function Metrics()
-
On Error GoTo Err_Mod_MIS
-
-
Dim ftp_Date
-
Dim LocMetrics, StrMetrics As String
-
Dim RstMetrics As Recordset
-
Dim MIS_Query As String
-
-
-
DoCmd.SetWarnings False
-
ftp_Date = Format(Date, "yyyymmdd")
-
LocMetrics = DLookup("location", "tbl_location", _
-
"[function]='Metrics'")
-
MsgBox LocMetrics
-
StrMetrics = LocMetrics & "Metrics_" & ftp_Date & ".xls"
-
MsgBox StrMetrics
-
-
MIS_Query = "select * into MIS_COUNTS from XXXX "
-
-
DoCmd.RunSQL (MIS_Query)
-
-
DoCmd.TransferSpreadsheet acExport, 8, "MIS_Counts", StrMetrics, True, ""
-
-
-
-
Exit_Mod_MIS:
-
DoCmd.SetWarnings True
-
Exit Function
-
-
Err_Mod_MIS:
-
MsgBox Err.Number & " - " & Err.Description
-
Resume Exit_Mod_MIS
-
-
End Function
Below is the query i want assign it to MIS_Query.in my mdb file it is a passthry query i will run this with out any issues but when i copy the sql and try to run as separate then iam getting syntax error. It is because of case not allowed in access, but how i can able to run this with out any issues when it is a passthru query any difference
------------------------------------------------------------- - select d.DEAL_FOLDER_STATUS, d.VALUE_DATE, d.BUSINESS_DATE,
-
case
-
when d.BUY_SETL_TYPE_IND = 11
-
then 'NET PEND'
-
when d.BUY_SETL_TYPE_IND = 12
-
then 'NETTED '
-
when d.buy_setL_type_ind = 15
-
then 'NET AS GROSS'
-
when d.buy_setl_type_ind = 19
-
then ' NET GO GROSS'
-
when d.BUY_SETL_TYPE_IND = 21
-
then 'GROSS PEND'
-
when d.BUY_SETL_TYPE_IND = 26
-
then 'GROSS AGGR'
-
when d.BUY_SETL_TYPE_IND = 22
-
then 'GROSS AD HOC'
-
when d.BUY_SETL_TYPE_IND = 29
-
then 'GROSS '
-
when d.BUY_SETL_TYPE_IND > 40
-
then 'CLS '
-
ELSE cast(d.buy_setl_type_ind as char(2))
-
end as setl_type
-
,d.LEGAL_ENTITY_ID, d.CPTY_ID, c.formal_name, tm.book_area_id as trade_type
-
,d.BUY_CCY_ID, d.BUY_AMOUNT, d.SELL_CCY_ID, d.SELL_AMOUNT, d.DEAL_RATE, tm.acct_ccy_equiv_amt,tm.TRADE_SOURCE_ID
-
, case
-
when tm.trade_source_id = 'RMS'
-
then (substr(tm.fo_deal_id,5,10))
-
else tm.fo_deal_id
-
end as fo_trade_id
-
,d.DEAL_FOLDER_ID, s.SETL_FOLDER_ID, tm.ndf_ind
-
, d.FULLY_MATCHED_IND,d.INST_OK_IND, tm.portfolio_id
-
from cpty c, cpty_legal_entity cle, deal_folder d, setl s, trade_master tm
-
where
-
cle.company_id = c.company_id
-
and cle.cpty_id = c.cpty_id
-
and d.company_id = cle.company_id
-
and d.legal_entity_id = cle.legal_entity_id
-
and d.cpty_id = cle.cpty_id
-
and c.record_state = 'V'
-
and cle.cpty_id LIKE 'ABSA JB%'
-
and cle.record_state = 'V'
-
and d.record_state = 'V'
-
and d.value_date > (substring(cast(current_timestamp as char(16)) from 1 for 8))
-
and s.deal_folder_id = d.deal_folder_id
-
and s.ccy_id = d.buy_ccy_id
-
and tm.trade_id = d.trade_id
-
and tm.trans_id = d.trade_trans_id
-
and tm.ver_id = d.trade_ver_id
-
order by d.value_date , SETL_TYPE, tm.book_area_id , d.BUY_CCY_ID , d.SELL_CCY_ID , d.CPTY_ID
NeoPa 32,556
Expert Mod 16PB @harshakusam
I think it should yes.
The code as is will put the file in the current directory with a name matching the name of the query, but with ".Xls" on the end.
NeoPa 32,556
Expert Mod 16PB @harshakusam
I can't say I've tried using a Pass-Thru query myself for this, but I expect any QueryDef or Table should work consistently.
If the SQL you posted is stored as a QueryDef and the Return Records property is set to true, then I see no reason why it wouldn't work.
NeoPa 32,556
Expert Mod 16PB @harshakusam
I don't know what this one is about. I see no connection between this post and the question :S
Hi Neopa,
I my self confused and confusing all...
I have a mdb file it's having almost 120 passthru queries in it.
We daily run each query and export the output to excel
All this process takes 2 hrs
I want this to automate by some way is it possible
I guess you should clarify what those queries actually do.
Taking into account the code you've posted they probably are not SELECT queries.
NeoPa 32,556
Expert Mod 16PB @harshakusam
We seem to be going over old ground here.
I believe I've already answered these points as well as I'm able. There was a pointer in an earlier post for which I've seen no response from you. There's really not much point in starting again if you don't reply to points in the conversation. I can only see that we would get back to the same point and waste much time and effort in the process.
I appreciate that it's probably hard for you to communicate well in English, but it still won't get us anywhere if you don't reply to what I post.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Chris Gallucci |
last post by:
I need help with what I think may be a design issue.
I need to access a record for processing. I need to do it in such a fashion that several concurrent processes do not access the same
record.
...
|
by: DG |
last post by:
Hi,
Can anyone advise how to execute multiple statements in a single query
batch. For example-
update customers set customer_name = 'Smith' where customer_name =
'Smyth';
select * from...
|
by: Javier Fernandez |
last post by:
We just migrate out p690 from kernel 32 bits to kernel 64 bits in
order to migrate DB2 v7 to DB2 v8 FP3.
The only problem without a solution we find out is since we did the
change we cannot run...
|
by: Dom Boyce |
last post by:
Hi
First up, I am using MS Access 2002.
I have a database which records analyst rating changes for a list of
companies on a daily basis. Unfortunately, the database has been set
up (by my...
|
by: AAVF IT |
last post by:
Hi
I am developing an application in MS Access 2000 that is to bolt on to an
existing Access database, that links via ODBC to our UNIX-based factory
management system. I need some help in this...
|
by: Tarun Mistry |
last post by:
Hi all, I have posted this in both the c# and asp.net groups as it applies
to both (apologies if it breaks some group rules).
I am making a web app in asp.net using c#. This is the first fully OO...
|
by: matrekz42 |
last post by:
Good morning Gurus,
I'm trying to execute the following code to run multiple queries, and update the progress bar on a form, but it doesnt seem to respond. Do I have too many queries, what am I...
|
by: Dave |
last post by:
I have a global.asax file with Application_Start defined and create some
static data there and in another module used in the asp.net application and
I realize that static data is shared amongst...
|
by: Supermansteel |
last post by:
My team at work uses Cognos to run multiple queries to pull in data. Then they take that data and import into Access and then usually run an Append Query to run a RND function to pull out a few...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |