By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,148 Members | 774 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,148 IT Pros & Developers. It's quick & easy.

Create an accde file using VBA

P: 11
Is it possible to create an accde file from an accdb file using VBA? Either the currently open database or one that is external to the currently open database would work for the purpose I have in mind.

You guys are geniuses so I know that if it can be done one of you will have the answer so thanks in advance!

m
Jan 18 '19 #1
Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,494
Have you considered Application Automation?
Jan 18 '19 #2

twinnyfo
Expert Mod 2.5K+
P: 3,284
This will work for converting a different, non-open DB:

Expand|Select|Wrap|Line Numbers
  1. Public Sub CreateACCDE()
  2.     Dim strDBFile As String
  3.     Dim strDEFile As String
  4.     Dim objACC As Access.Application
  5.  
  6.     strDBFile = "C:\DBFile.accdb"
  7.     strDEFile = "C:\DBFile.accde"
  8.  
  9.     Set objACC = New Access.Application
  10.  
  11.     objACC.SysCmd 603, strDBFile , strDEFile 
  12.     objACC.Quit acQuitSaveNone
  13.  
  14.     Set objACC = Nothing
  15. End Sub
I personally prefer to do it manually, so I can see if there were any errors during the compile.

Hope this hepps!
Jan 18 '19 #3

NeoPa
Expert Mod 15k+
P: 31,494
Am I missing something? The code simply does the conversion. The compiling step isn't included.

Doesn't that mean the user would still see the compiler errors directly? Also that the requirement would be for a non-open and compiled database file?

PS. Well done for providing the code. I hadn't realised that step was an undocumented one when I suggested they look up Application Automation.
Jan 19 '19 #4

Post your reply

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