设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 2071|回复: 4
打印 上一主题 下一主题

[Access本身] macro runcode 的问题

[复制链接]
跳转到指定楼层
1#
发表于 2005-9-14 18:52:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
> I have code I want to execute when I open Access.  I've

> created a macro with 'RunCode' - cdeLinkDB2Tables.

>

> When I try to run my macro, I get an error message:

>

> "Microsoft Access can't find the name 'cdeLinkDB2Tables'

> you entered in the expression."

>

> I'm using Access 2000 with VB6.0 on an win2000 on the

> backend.  The code DOES work, in debug mode.  Here:

>

> table - tblODBCTables - db, library, table, index field

> names

>

> macro - mcrLinkDB2Tables - RunCode - cdeLinkDB2Tables

>

> module -

>   mdl_MainProcedure -

>     Public Function cdeLinkDB2Tables

>     Public Sub cdeDeleteODBCTableNames

>

> cdeLinkDB2Tables - code was debugged when this 'function'

> was temporaarily made a 'sub'.  All the current ODBC

> table links are deleted and recreated per the entries in

> the table tblODBCTables.

>

> I came across a note about the module name not being the

> same as the macro name, or some such (hence the 'cde'

> prefix on the VBA code).  But I still get the error.

> Anyone have any ideas?  Can anyone see what it is that

> I'm [still] missing?

>

> Thanks a lot, in advance,

>

找不到函数名?原因不明白,不是大写空格,也不是中文或者日文的函数名的问题?英文函数名也找不到?请各位指点一下。
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
 楼主| 发表于 2005-9-14 19:21:00 | 只看该作者
对不起,我的操作系统是xp,不是win2000,这个问题在2000下面就不存在了,但是在XP系统下一直存在这个问题。
3#
 楼主| 发表于 2005-9-14 19:43:00 | 只看该作者
原来是office2003,之后又改回到office2000,这个也是出错的原因?[em06]
4#
 楼主| 发表于 2005-9-15 17:39:00 | 只看该作者
[em06]各位老大,还是存在这个问题啊,到底是版本的问题,还是操作系统的问题啊?用宏调用函数(带有参数)就出现问题了,原来程序里的 函数名(command())里面的参数command()的意思不清楚,用向导 添加宏得到的是       函数名(<参数名>),直接运行还是出错,还请指点一下。[em06]
5#
 楼主| 发表于 2005-9-15 18:36:00 | 只看该作者



用户定义的 Function 过程保存在 Microsoft Access 的模块中。 即使 Function 过程没有参数,括号也是必须的,如下例: TestFunction()Function Name 参数中的函数名称不须以等号 (=) 开头,这与用于事件过程设置的用户定义函数名称不一样。 Microsoft Access 将忽略函数的返回值。 注意 如果函数的名称与模块名相同,不能从宏中调用 Function 过程。 提示 要运行用 Visual Basic 写成的 Sub 过程或事件过程,请创建调用 Sub 过程或事件过程的 Function 过程,然后再使用 RunCode 操作运行该 Function 过程。 如果用 RunCode 操作调用函数,Microsoft Access 将查找由数据库的标准模块的 Function Name 指定的函数。不过,如果是通过选择窗体或报表的菜单命令或在产生窗体或报表事件时运行该操作,Microsoft Access 将首先查找窗体或报表类模块中的第一个函数,然后再在标准模块中查找。Microsoft Access 不会在“数据库”窗口“模块”选项卡中显示的类模块中查找由 Function Name 参数指定的函数[em06]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-9 17:40 , Processed in 0.087983 second(s), 28 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表