Template Wizard - "Saving to Database" Problem

P

pam asar

Hi everyone,

Using the "Template wizard" add-in, I've created an XLT
file with the ms Access database on the back-end. This
works well and I was able to enter data in the template
and save it as both "XLS" file and a record in the MS
Access database.

However, when writing a code to autmatically save the data
in the same manner, the program just saved XLS file but
didn't even prompt for "saving to database" options. As a
result there's no record created in the MS Access
database:)

Here's my code...

ActiveWorkbook.SaveAs Filename:="C:\Test.xls", _
FileFormat:=xlNormal, Password:="",
WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False

Anyone has any idea what's wrong with this and how to fix
this problem? Any help is much appreciated.

Thanks in advance,
Pam
 
D

Dick Kusleika

Pam

After your SaveAs line, put this line

Application.Run "Commit"

That will bring up the dialog that asks whether to save a new record.
 
P

Pam Asar

I just tried what Dick suggested and it works
magically...I wonder what's the "commit", a built-in macro?
Thx much,
Pam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top