Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
If statement Access宏中的IF语句_If Statement_Conditional_Ms Access 2013 - Fatal编程技术网

If statement Access宏中的IF语句

If statement Access宏中的IF语句,if-statement,conditional,ms-access-2013,If Statement,Conditional,Ms Access 2013,如果父数据表中的ID键大于子表中的ID键(分别名为Hoover data和Hoover Match),我尝试使用access中的宏实用程序运行追加查询 “我的宏”具有以下对象: SetWarnings, No If Max([Hoover Data]![ID])>Max([Hoovers Match]![ID]) OpenQuery, 'Hoovers Match Update' CloseWindow, 'Hoovers Match Update' SetW

如果父数据表中的ID键大于子表中的ID键(分别名为
Hoover data
Hoover Match
),我尝试使用access中的宏实用程序运行追加查询

“我的宏”具有以下对象:

SetWarnings, No
   If Max([Hoover Data]![ID])>Max([Hoovers Match]![ID])
      OpenQuery, 'Hoovers Match Update'
      CloseWindow, 'Hoovers Match Update'
SetWarnings, Yes
我的查询,
Hoovers Match Update
运行良好,在添加if语句之前,我的宏也运行良好——也就是说,尽管上面的宏配置是正确的

使用if语句运行宏时,收到以下错误: Access找不到您在表达式中输入的名称
Hoover Data


我正在Win 7(64位)计算机上运行Access 2013(32位)

要引用外部表/查询中的聚合,请使用域聚合系列。特别为您:


此外,无需关闭操作查询(追加/删除/更新)

谢谢你,帕菲,我仍在从“Excel思维”过渡,但这不仅回答了我的问题,而且提高了我对域聚合函数的认识&以编程方式启动操作查询的本质——完美、简洁、全面的回答,多谢各位-E
SetWarnings, No
   If DMax("ID", "[Hoover Data]") > DMax("ID","[Hoovers Match]") Then
      OpenQuery
        Query Name 'Hoovers Match Update'
   End If          
SetWarnings, Yes