开发者

In access-vba, what triggers run-time error 2046 (The command or action 'RunSQL' isn't available now)

开发者 https://www.devze.com 2023-01-18 04:58 出处:网络
There is an oddity in my VBA module. Sometimes I get a run-time error 2046: The command or action \'RunSQL\' isn\'t available now.

There is an oddity in my VBA module. Sometimes I get a run-time error 2046: The command or action 'RunSQL' isn't available now. When I try it again later, w开发者_开发知识库ithout changing any code, it no longer gives the error, some time later, it does again.

Does anyone know what triggers this run-time error? And how can I avoid it?

I think the problem has something to do with doCmd

The line that shows the error is as follows:

DoCmd.RunSQL "CREATE TABLE " & tableName & " (" & tableDefinition & ")"

There is no table with the same name.


1st of all creating table in access not with "create table". this is the example to make new table with access vb:

DoCmd.RunSQL ("SELECT '" & Value & "' as [nameOfField] &'"INTO"' & tableName ) 
0

精彩评论

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

关注公众号