多标准dlookup麻烦vba access 2010(accdb) [英] multiple criteria dlookup troubles vba access 2010(accdb)

查看:68
本文介绍了多标准dlookup麻烦vba access 2010(accdb)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究vba访问数据库中的时钟系统。我正在尝试进行系统设置,所以当你按下按钮时,它会检查你当天是否有时钟。如果你有,它会显示一条消息,告诉你今天已经进入了。我想查找两个值。它首先检查员工ID,第二个查找今天的日期。


我正在使用带有员工ID和日期作为初选的复合密钥。我昨天在这个工作了好几个小时,在这个dlookup中找不到我的错误。


所有内容都设置为字符串,因为我之前在数据库中做了一个搞砸,并且不想再回过头来。 EmpID设置为字符串。 Date目前是字符串,但如果需要更改,我肯定这不会引起太多问题。


无论如何我得到一个null这个dlookup的价值,所以我确定我的语法在某种程度上是错误的。评估这个dlookup的任何帮助都会有所帮助。


变量的实际名称如下


strEmpID as string

Datetoday as string


最后在最后一次尝试中我试图从表单上的组合框中直接输入。

I''m working on a timeclock system in a vba access database. I''m trying to get the system setup so when you hit the clock in button it checks to see if you have clocked in at some point that day. if you have it displays a message telling you you have already clocked in today. I am trying to look up two values. it first checks for the employee id and the second looks up the date today.

I''m using a composite key with the employee ID and the date as the primaries. I was working on this for several hours yesterday and just cannot find my mistake in this dlookup.

everything is setup as strings because of a screw up i made earlier in the database and did not want to have to go back through it. The EmpID is setup as string. The Date is currently as string but if it needs to be changed I''m sure that wouldn''t cause too much of an issue.

Anyway I''m getting a null value off of this dlookup so i''m sure my syntax is wrong on some level. Any help evaluating this dlookup would help.

Actual names of variables are as follows

strEmpID as string
Datetoday as string

lastly in this last attempt i was trying to take the direct input from the combo box on the form.

展开 | 选择 < span class =codeDivider> | Wrap | 行号

推荐答案

符合您的标准需求包含在双引号中,然后除了单词之外还放置了一个&符号。
The And in your criteria needs included inside your double quotes and then have an ampersand placed there in addition to the word And.
展开 | 选择 | Wrap | 行号


很抱歉,我花了这么长时间才回复。劳动节周末,所有我都很忙。我尝试了你放下的东西,但它仍然返回一个空值。 [DateWorked]字段的格式为短日期。这可能与它有关吗?也许它检查一个更具体的值,所以它返回一个空值?给出的任何输入都很棒。
Sorry it took me so long to reply. With labor day weekend and all I''ve been busy. I tried what you put down but it is still returning a null value. The [DateWorked] Field is formatted as short date though. Could that have something to do with it? maybe its checking for a more specific value so it''s returning a null value? any input given would be fantastic.


试试这个:
Try this:
展开 | 选择 | Wrap | 行号


这篇关于多标准dlookup麻烦vba access 2010(accdb)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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