I am connecting to MS Access DB using vb.net as given below...
我使用vb.net连接到MS Access DB,如下所示...
oDBEngine = oAccess.DBEngine oDB = oDBEngine.OpenDatabase(Name:=strFullFileName, Options:=False, ReadOnly:=False, Connect:="")
oDBEngine = oAccess.DBEngine oDB = oDBEngine.OpenDatabase(Name:= strFullFileName,Options:= False,ReadOnly:= False,Connect:=“”)
And then opening the DB using the following syntex...
然后使用以下syntex打开数据库...
oAccess.OpenCurrentDatabase(filepath:=strFullFileName, Exclusive:=False)
Now my problem is:
现在我的问题是:
One of the DB contains a form which opens Automatically while we are opening the DB. So when I am trying to run the application for this particular DB the DB opens up. But as per my requirement I do not need to open the DB explicitly.
其中一个DB包含一个在打开数据库时自动打开的表单。因此,当我尝试运行此特定数据库的应用程序时,数据库会打开。但根据我的要求,我不需要明确地打开数据库。
Is there any way to restrict the DB to open in such cases?
在这种情况下有没有办法限制DB打开?
NOTE: This works fine for all other scenarios i.e. DB is not opening, but I can able to count Activex controls form each form as per my application requirement.
注意:这适用于所有其他方案,即数据库未打开,但我可以根据我的应用程序要求计算每个表单的Activex控件。
2 个解决方案
#1
You could try 'programmatically pressing the shift-key' through APIs:
您可以尝试通过API“以编程方式按shift键”:
#2
In your previous post on this topic : How to prevent to open a MS Access Database while reading data from forms, I suggested importing the forms into a blank database, you did not mention why this option did not suit, and I am curious as to why.
在您之前关于此主题的帖子中:如何防止在从表单读取数据时打开MS Access数据库,我建议将表单导入空白数据库,您没有提到为什么这个选项不合适,我很好奇为什么。
#1
You could try 'programmatically pressing the shift-key' through APIs:
您可以尝试通过API“以编程方式按shift键”:
#2
In your previous post on this topic : How to prevent to open a MS Access Database while reading data from forms, I suggested importing the forms into a blank database, you did not mention why this option did not suit, and I am curious as to why.
在您之前关于此主题的帖子中:如何防止在从表单读取数据时打开MS Access数据库,我建议将表单导入空白数据库,您没有提到为什么这个选项不合适,我很好奇为什么。