Rabu, 13 Oktober 2021

Re: [MSAccessProfessionals] Docmd.transferspreadsheet help

Jim – You weren’t alone. All the Access developers were equally confused about the future of DAO. Darn Microsoft!

 

Regards,
Bill Mosca,
Founder, MS_Access_Professionals

MS Access MVP 2006-2016
My Nothing-to-do-with-Access blog

https://wrmosca.wordpress.com

 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> On Behalf Of Jim Wagner
Sent: Wednesday, October 13, 2021 10:43 AM
To: MSAccessProfessionals@groups.io
Subject: Re: [MSAccessProfessionals] Docmd.transferspreadsheet help

 

Bill,

 

I had just started getting into writing code then. I remember researching code to do something and the examples were all referencing DAO as being old but there were no examples of how to write it in ADO. I was so confused.

 

Jim Wagner


From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Bill Mosca <wrmosca@comcast.net>
Sent: Wednesday, October 13, 2021 9:34 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Docmd.transferspreadsheet help

 

Jim

 

Back in 2000, MS made a big thing over the new ADO code that was supposed to replace DAO. They said DAO was dead and would soon be discontinued. I spent hundreds of hours re-writing several of my applications to do away with DAO and use ADO instead even though DAO still worked just fine. Then Access 2003 came out and MS mysteriously backed away from the claim that DAO was going away. To this day, DAO is the preferred way to work with data unless you’re talking about SOME, repeat, SOME SQL Server stuff. So all my code conversions were for naught.

 

Moral of the story: Don’t re-write your code unless there is a valid reason. That includes just using different syntax when the old stuff still works. Re-writing code not only is a waste of time. It’s most likely going to break something. Just because your car is dirty doesn’t mean you need to repaint it.

 

Regards,

Bill Mosca

 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> On Behalf Of Jim Wagner
Sent: Wednesday, October 13, 2021 9:23 AM
To: MSAccessProfessionals@groups.io
Subject: Re: [MSAccessProfessionals] Docmd.transferspreadsheet help

 

Thank You Bill. that saved a lot of time rewriting code.

 

Jim Wagner


From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Bill Mosca <wrmosca@myself.com>
Sent: Wednesday, October 13, 2021 9:13 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Docmd.transferspreadsheet help

 

On Tue, Oct 12, 2021 at 04:35 PM, Jim Wagner wrote:

Hello all,
I have a lot of vba that transfers spreadsheets into my databases and I have been using docmd.transferspreadsheet acImport, acSpreadsheetTypeExcel12 for a very long time. But now we are getting our data from Alteryx exported to .xlsx files instead of .xls files. I have looked online and there seems to be a bit of a discrepancy between the webpages. could someone help me and direct me to the proper syntax. 
I did find the below
DoCmd.TransferSpreadsheet acImport, 10, and it works but so does the others. 
Is there ramifications of having the incorrect syntax? 

Thank You 
Jim Wagner

Hi Jim

If your older code works go ahead and use it. The difference between .xls and .xlsx usually only have to do with new features. Transferring data wouldn't change unless you were using some kind of new data type which is unlikely in this circumstance.

MS is pretty good about backwards compatible VBA when it comes to the DoCmd. And Differences in code are sometimes just variations on the same process.
 
--

Regards,

Bill Mosca, Founder - MS_Access_Professionals

Microsoft Office Access MVP 2010-2016

My nothing-to-do-with-Access blog

 

Tidak ada komentar:

Posting Komentar