473,387 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Transfer spreadsheet functions - unexpainable results...

25
Good afternoon!

I use transfer spreadsheet function the export data from one of the table into the excel spreat sheet. I use the following code:
DoCmd.TransferSpreadsheet acExport, 8, "qry Rejected Items", Path & "Output Files\Rejected Items.xls", True, "NewData"

Please note that the output should be placed in the "NewData" tab.

In the same excel file the output was made to, i have function that is excecuted on open:

Sub Auto_Open()
'msgbox "stop before running code"
Call CheckNewData
ActiveWorkbook.Names.Add "PivotData", "=OFFSET(Data!$A$1,0,0,COUNTA(Data!$A:$A),COUNTA(D ata!$1:$1))"
Sheets("Pivot").PivotTables("PivotTable1").PivotCa che.Refresh
Sheets("Pivot").Activate
ActiveWorkbook.Save
End Sub

Public Sub CheckNewData()
On Error GoTo NoNewData
If Len(Sheets("NewData").Name) > 0 Then
'delete old
Application.DisplayAlerts = False
Worksheets("Data").Delete
'rename new
Worksheets("NewData").Name = "Data"
Application.DisplayAlerts = True
Else
'error no NewData
MsgBox "New Data Failed!" & Chr(13) & Chr(13) & "Contact Provider", , "Error"
Application.Quit
End If

NoNewData:
End Sub


The only thing all that should do is to check if there is a new tab called "NewData". if that's the case it should
1. delete old tab named "Data"
2. rename "NewData" tab to "Data" tab
3. define new name range (to be used in pivot table as a source)
4. refresh pivot table.


with all that i was able to export new data from access into the report in excel.

Looks all good so far, exept seems that the excel code got imbedded into the excel file. Seems like there is some code being excecuted before it ever gets to the auto_open module....

so if I put msgbox as my very first line in auto_open excel function, it will show me the message box exept all the data is already in place, without ever executing the code... I'll never see "NewData" tab, all the new data is in "Data" tab already!!!

How is that possible??? already spend hours doing the research with absolutely no luck.

I hope all that make sense.

I'll gladly send 2 sample files to show what happens (1 mdb file and 1 xls file).

Any help would be greatly appreciated.
Oct 11 '07 #1
1 2200
nico5038
3,080 Expert 2GB
Why not disable the auto_open code (or even remove it) entirely ?

Nic;o)
Oct 11 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
2
by: quadric | last post by:
Hi, I have an application that requires that Python initiate and mediate a live and iterative conversation between an external application (in which Python is embedded) and an external Excel...
8
by: Catherine Jo Morgan | last post by:
Some columns in the excel contact info spreadsheet correspond exactly with the new database fields. Three columns contain a mishmash of info that will need to be entered manually in the correct...
6
by: Duncan Smith | last post by:
Hello, I am currently implementing (mainly in Python) 'models' that come to me as Excel spreadsheets, with little additional information. I am expected to use these models in a web application. ...
5
by: barien75 | last post by:
Does anyone know if there is a way to specify the file to transfer from? The files I need are all named the same with one small difference. Each one has the days date at the end of the file name....
0
by: mix01 | last post by:
Hi, I am trying to get some VBA code working, but am preplex as to why it does not work. I would really appreciate any level of help. Many thanks, Mix01 Version of the program
9
by: HHung1977 | last post by:
Hello All - I currently have a database with a module that manipulates some data from Oracle and then writes the data into a table. I want to export the table to a web server, but when I use the...
8
by: Perl Beginner | last post by:
I am using Win32. I have created an excel spreadsheet, formatted the columns and rows, and would like to write to the cells…all of this using Spreadsheet::WriteExcel. My issue is, my script is very...
0
by: gjones | last post by:
I have an Oracle Forms application and I want to populate an Excel spreadsheet with some data from the application. I am using the DDE.Poke command to transfer data into the spredsheet and that is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
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...
0
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...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
Oralloy
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.