多个Dlookup用于查看多个表中的值 [英] multiple Dlookups for looking on values in multiple tables

查看:63
本文介绍了多个Dlookup用于查看多个表中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以用d查找两个表格


我想要的是取决于我在组合框中选择什么程序的情况,在一个组合框中查看它的时间值员工表


timevalproc - 在vba中分配dlookup功能的变量

tblEmployees

tblProcedure
[Haircut]或[Eyebrows] = [txt ID]

以及tblEmployees上每个程序的时间:


我有这个代码作为一个例子,这是我试过的,它很接近,但我找不到错误在哪里

I know I can look in two tables with d lookup

What I want is depending the case of what procedure I choose in a combo box, to look its time value in a employees table

timevalproc-The variable to assign the dlookup function in vba

tblEmployees
tblProcedure
[Haircut] or [Eyebrows] = [txt ID]
and the time for each of the procedures which is on tblEmployees:

I have this code as an example, this is what I tried, it''s close, but I can''t find where is the error

展开 | 选择 | Wrap | 行号

推荐答案

让我们从:
Allen Browne的扩展DLookup()代码


  1. 看起来像一个轻微的语法错误,特别是在'[txtID]之后的''。这应该工作:
  1. Looks like a slight Syntax Error, particularly the '' after [txtID]. This should work:
展开 | 选择 < span class =codeDivider> | Wrap | 行号


感谢您对该解决方案的回复


Zmbd


1.我在尝试将ELookup调整到我的场景时遇到了麻烦,我知道它可以评估2个标准,但我找不到任何例子能够做到这一点


ADezii


2.我尝试了你的第一种方法,它给我一个错误


运行时错误2465

我的程序找不到字段''| 1'在你的表达中重写。


3.第二种方法抛出一个错误说


运行时错误3464


标准表达式中的数据类型不匹配
Thank you both for your replies for the solution

Zmbd

1. I''m having trouble trying to adapt the ELookup to my scenario, I know It can evaluate 2 criterias but I can''t find any examples to be able to do it


ADezii

2. I tried your first approach and it throws me an error

Run-Time error 2465

"My program can''t find the field ''|1'' refferred in your expression."

3.the second approach throws me an error saying

Run-Time error 3464

"Data type mismatch in criteria expression"


这篇关于多个Dlookup用于查看多个表中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆