473,394 Members | 1,702 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,394 software developers and data experts.

acCmdImportAttachExcel (Access 2007)

JustJim
407 Expert 256MB
Hi all,

I've got a client that upgraded to Vista and Office 07 thereby breaking one of my applications that they were using.

Apologies for vagueness in the following question - I'm off-site and don't have Access 07 here.

The problem is most in evidence in a line of code that used the TransferSpreadsheet method which now seems to have trouble figgering out what goes where and whether or not I'm using a header line in the spreadsheet file.

I've come across (in this forum) the Access 07 command acCmdImportAttachExcel.

Can someone who has Access 07 pass along to me the arguments for this command and any further details you've noticed when using it.

Thanks
Jim
May 13 '09 #1
7 11957
puppydogbuddy
1,923 Expert 1GB
There are no arguments. The command opens an Excel import dialog box. For .txt and .csv file types, you would use RunCommand acCmdImportAttachText. An example of the code used behind a button is shown below.

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnImportTable_Click()
  2. On Error Resume Next
  3. RunCommand acCmdImportAttachExcel     
  4. End Sub
  5.  
See this thread for additional pertinent information:
http://bytes.com/topic/access/answer...-access-2007-a
May 13 '09 #2
JustJim
407 Expert 256MB
Thanks PDB,

Your link was where I found out about the command (great minds etc). Probably not going to be automated enough for my users, but I'll give it a go when I get back on site again tomorrow - another suit and tie day darnit.

Thanks again

Jim
May 13 '09 #3
JustJim
407 Expert 256MB
Reporting back just for completeness; I did the suit and tie thing today (on-site school visit) and used
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunCmd acCmdImportAttachExcel
and took the users through the dialogs and how to save the import specs. It was so much simpler for them with the old DoCmd.TransferSpreadsheet etc etc which Access 2007 seems to get confused about. It doesn't error out, it just doesn't seem to know where to put stuff!

Anyway, new, web-based version coming up so; no blood, no foul?

Jim
May 14 '09 #4
puppydogbuddy
1,923 Expert 1GB
Jim,
MS is coming out with sp2 soon which contains many bug fixes, and restores the functionality of the OutputTo (excel) command (very similar to TransferSpreadsheet). You might want to look into that.
May 14 '09 #5
JustJim
407 Expert 256MB
@puppydogbuddy
Yes, I'm probably going to have to bite the bullet and build a Vista/Office 07 machine, at least one to use at home (my office).

Then again, Windows 7 is going to fix everything, isn't it? Now where have I heard that before?

Jim
May 14 '09 #6
Take a look at the ImportExportSpecification object. This should let you create, save, and execute an import or export operation without opening the dialog box for the users.

http://msdn.microsoft.com/en-us/library/bb256359.aspx
Nov 13 '09 #7
To better clarify my suggestion, here is how I used the ImportExportSpecifications:

CurrentProject.ImportExportSpecifications.Add "Excel Import", "<?xml version='1.0' encoding='utf-8' ?>" & _
"<ImportExportSpecification Path = 'C:\Documents and Settings\rjgibso\My Documents\MCN-Applicants-Mthly.xlsx' xmlns='urn:www.microsoft.com/office/access/imexspec'>" & _
"<ImportExcel FirstRowHasNames='true' AppendToTable='Data' Range='&apos;MCN-Applicants--Mthly#qry$&apos;' >" & _
"<Columns PrimaryKey='{Auto}'>" & _
"<Column Name='Col1' FieldName='FNAME' Indexed='NO' SkipColumn='false' DataType='Text' />" & _
"<Column Name='Col2' FieldName='MNAME' Indexed='NO' SkipColumn='false' DataType='Text' />" & _
"<Column Name='Col3' FieldName='LNAME' Indexed='NO' SkipColumn='false' DataType='Text' />" & _
"<Column Name='Col4' FieldName='UID' Indexed='YESDUPLICATES' SkipColumn='false' DataType='Double' />" & _
"<Column Name='Col5' FieldName='APPL-CCYYS' Indexed='NO' SkipColumn='false' DataType='Double' />" & _
"<Column Name='Col6' FieldName='ADM-MAJOR' Indexed='NO' SkipColumn='false' DataType='Double' />" & _
"<Column Name='Col7' FieldName='MAJOR NAME' Indexed='NO' SkipColumn='false' DataType='Text' />" & _
"<Column Name='Col8' FieldName='ADM-MAJSEQ' Indexed='NO' SkipColumn='false' DataType='Double' />" & _
"<Column Name='Col9' FieldName='SEQ' Indexed='NO' SkipColumn='false' DataType='Text' />" & _
"<Column Name='Col10' FieldName='ADM-DEC' Indexed='NO' SkipColumn='false' DataType='Text' />" & _
"<Column Name='Col11' FieldName='DEC-DATE' Indexed='NO' SkipColumn='false' DataType='DateTime' />" & _
"<Column Name='Col12' FieldName='APPL-RECEIVED' Indexed='NO' SkipColumn='false' DataType='Text' />" & _
"<Column Name='Col13' FieldName='ADM-CLASS' Indexed='NO' SkipColumn='false' DataType='Text' />" & _
"<Column Name='Col14' FieldName='RACE' Indexed='NO' SkipColumn='false' DataType='Double' />" & _
"<Column Name='Col15' FieldName='CITIZENSHIP' Indexed='NO' SkipColumn='false' DataType='Double' />" & _
"</Columns>" & _
"</ImportExcel>" & _
"</ImportExportSpecification>"
CurrentProject.ImportExportSpecifications.Item(Cur rentProject.ImportExportSpecifications.Count - 1).Execute
CurrentProject.ImportExportSpecifications.Item(Cur rentProject.ImportExportSpecifications.Count - 1).Delete


If you are not sure about all of the column names and options and you want to get it right the first time, you should go through the External Data, Import option Wizard and select the "Save Import Steps" when you are finished importing it the exact way that you will always want to. Then create a large text box called txtBig and a button that calls an event procedure. In the procedure, type this code:

txtBig.value = CurrentProject.ImportExportSpecifications.Item(Cur rentProject.ImportExportSpecifications.Count - 1).XML

Just click the button and your text box will have all of the complicated XML ready for you to copy and paste into your CurrentProject.ImportExportSpecifications.Add() command.

You will also need to replace the double quotes with single quotes, but this is easy enough by using the Replace... tool in notepad.

Enjoy!
Nov 13 '09 #8

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

Similar topics

37
by: jasmith | last post by:
How will Access fair in a year? Two years? .... The new version of Access seems to service non programmers as a wizard interface to quickly create databases via a fancy wizard. Furthermore, why...
27
by: Wayne | last post by:
I've been clicking around Access 2007 Beta 2 and can't see the custom menu bar designer. Is it in the beta? Maybe I'm blind. The question that comes to mind is: Will custom menu bars be the same...
1
by: Bob Alston | last post by:
Anyone know of any features of the new Access 2007 that will improve on the ability of Access to work in a web environment??? Bob
1
prn
by: prn | last post by:
Hi folks, I'm relatively new to Access, but I seem to have drawn the short straw, so I have the assignment for my workplace of looking for problems/inconsistencies in migrating applications to...
17
by: Neil | last post by:
A client of mine likes some of the new bells and whistles in Access 2007, and is thinking about converting our A03 format MDB to an A07 format file. However, while some of the users have A07, many...
8
by: ajos | last post by:
hi frnds, im trying to convert my servlets database configuration from ms access to mysql database.however im getting some error like no driver found exception. to verify this error ive...
10
by: Arno R | last post by:
Hi all, So I bought a new laptop 10 days ago to test my apps with Vista. (home premium) Apparently Office 2007 is pre-installed. (a time limited but complete test version, no SP1) So I take the...
9
by: prakashwadhwani | last post by:
Hi !! I'm about to develop a new project for a client. Should I go about it in Access 2003 or 2007 ? Purchasing it either for me or for my client is not a major consideration here ... what I'd...
1
by: ARC | last post by:
I think I made a major blunder, and now Access 2007 no longer opens. I made the mistake yesterday of using the "test" option in wise installer for my Access 2007 runtime app. It actually installed...
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: 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
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...
0
tracyyun
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 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.