本文介绍了DLookup(“[PVIN]”,“tblPreliminaryVINs”,“[PVIN] = Forms!frmVINODO!SerialNum”)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 DLookup(" [PVIN]",tblPreliminaryVINs, " [PVIN] = Forms!frmVINODO!SerialNum") 给我一个类型不匹配错误。这让我感到困惑 我不知道如何规避它。 tblPreliminaryVINs中的[PVIN]字段是一个17字符的文本字段。表单!frmVINODO!SerialNum 只是表单上的未绑定文本框(frmVINODO)。 我在文本框的BeforeUpdate事件代码中运行DLookup 。我输入的一些 VIN值不会引起错误。有些人。通过 性质,VIN值是字母数字。我应该在CStr()中包装 表格!frmVINODO!SerialNum吗? DLookup("[PVIN]", "tblPreliminaryVINs","[PVIN]=Forms!frmVINODO!SerialNum") is giving me a Type Mismatch error. That''s confusing to meand I don''t know how to circumvent it. The [PVIN] field intblPreliminaryVINs is a 17-char text field. Forms!frmVINODO!SerialNumis just an unbound textbox on a form (frmVINODO). I run the DLookup during the textbox''s BeforeUpdate event code. SomeVIN values I type in there do NOT give rise to the error. Some do. Bynature, the VIN values are alphanumeric. Should I be wrapping theForms!frmVINODO!SerialNum in CStr( ) or something?推荐答案 不是CStr,但你需要用引号括起来。 DLookup([PVIN],tblPreliminaryVINs,_ " [PVIN] ="""& Forms!frmVINODO!SerialNum &"""") - Randy Harris tech at promail dot com 我很确定我知道我记得的一切。 Not CStr, but you need to wrap it in quotes. DLookup("[PVIN]", "tblPreliminaryVINs", _"[PVIN]=""" & Forms!frmVINODO!SerialNum & """")--Randy Harristech at promail dot comI''m pretty sure I know everything that I can remember. 嗯?没想到引号。我接受了边缘尝试 以确定Forms!frmVINODO!SerialNum是否在BeforeUpdate事件代码中具有可读值 。如果 导致我的问题,我不知道。 Hmmm? Hadn''t thought about the quotes. I got sidelined tryingto determine whether Forms!frmVINODO!SerialNum even hasa readable value in the BeforeUpdate event code. I dunno ifthat is contributing to my problem. 进一步测试证明,如果我在表单中输入 JT4RN81A0M0077777,我会收到错误!frmVINODO! SerialNum #AND#在tblPreliminaryVINs中有一条记录,其中[PVIN] 字段值为JT4RN81A0M0077777。但是如果在tblPreliminaryVINs中没有 记录时,如果使用[PVIN]字段值 的JT4RN81A0M0077777代码行运行,则不会出现错误 触发。这让我很难过。 Further testing proves that I get the error if I enterJT4RN81A0M0077777 into Forms!frmVINODO!SerialNum#AND# there is a record in tblPreliminaryVINs with a [PVIN]field value of JT4RN81A0M0077777. But if there is NOT arecord in tblPreliminaryVINs when with a [PVIN] field valueof JT4RN81A0M0077777the code line runs, no error istriggered. That stumps me. 这篇关于DLookup(“[PVIN]”,“tblPreliminaryVINs”,“[PVIN] = Forms!frmVINODO!SerialNum”)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-26 23:10