开发者

Calling Access Macro from VB.NET problems

I call an Acc开发者_JAVA百科ess macro from vb.net like so:

Acc.DoCmd.RunMacro("Macro1")

The Macro in Access has many OpenQuerys and Msgbox with a message saying "data done" at the end.

When I execute the macro from vb.net, it shows the data done message and then done. However, when I analyse the table's to see if data has been appended, it hasen't.

When I run the same macro from within Access, it works fine. It does show many messages like "You are about to run an append query that will modify data in your query" and I hit yes and does take slightly longer, but it does do it. In VB.NET, the only message I get is the final messagebox.

I have also tried:

Acc.SetOption("Confirm Action Queries", 0)
Acc.SetOption("Confirm Document Deletions", 0)
Acc.SetOption("Confirm Record Changes", 0)

before executing the macro from within VB.NET but to no avail. Still works the same.

Is there a way to fix it?

EDIT: My Access DB is mdb file


I think the problem is with the UI messages in the macro: It does show many messages like "You are about to run an append query that will modify data in your query" and I hit yes

There's an option in Access to suppress these confirmation queries, you'll want them suppressed in the .mdb file. Looks like attempting to suppress them from VB isn't working.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜