ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Template Wizard - "Saving to Database" Problem (https://www.excelbanter.com/excel-programming/273478-template-wizard-saving-database-problem.html)

pam asar

Template Wizard - "Saving to Database" Problem
 
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




Dick Kusleika

Template Wizard - "Saving to Database" Problem
 
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.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"pam asar" wrote in message
...
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






pam asar

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




-----Original Message-----
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.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"pam asar" wrote in message
...
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





.



All times are GMT +1. The time now is 01:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com