简体   繁体   English

存取2013 Dlookup问题

[英]Access 2013 Dlookup issue

good morning all I usually find the answer to my queries already on here but this one has me stumped. 早上好,我通常会在这里找到我所提出问题的答案,但是这个问题让我很困惑。 I have 3 tables, area containing Area and Region, Phones comtaining phone number and IMSI (SIM number) and a log containing all 4 fields. 我有3个表, area包含区域和地区, Phones comtaining电话号码,IMSI(SIM卡号码)和log包含所有4个领域。 I've put in a Dlookup (as found on this site) on the log and although it works the first time the event is triggered it allways comes up with the wrong value. 我在日志中放入了一个Dlookup (在此站点上找到),尽管它在第一次触发事件时起作用,但Dlookup产生错误的值。 It's probably something stupid and simple, it's years since I used Access and that was probably Access 2007 or something. 这可能是愚蠢而简单的事情,距我使用Access已经有很多年了,那可能是Access 2007之类的东西。

Hope you can help. 希望能对您有所帮助。 I have created a cut down test version but not sure how to add it to the question. 我已经创建了一个缩减测试版本,但不确定如何将其添加到问题中。

The VB code is here VB代码在这里

Private Sub Area_Change() 
Dim FoundRegion As String 
FoundRegion = DLookup("[Region]", "[Area]", "'[Area]![Area]=[Area]'") 
Me.Region = FoundRegion 
End Sub 
Private Sub Phone_Number_AfterUpdate() 
Dim FoundIMSI As Double 
FoundIMSI = DLookup("[IMSI ]", "[phones]", "'[phones]![Phone Number]=[Phone Number]'") 
Me.IMSI = FoundIMSI 
End Sub 

not sure how to add the database 不确定如何添加数据库

Private Sub Area_Change() Dim FoundRegion As String FoundRegion = DLookup("[Region]", "[Area]", "'[Area]![Area]=[Area]'") Me.Region = FoundRegion End Sub 私有子区域Area_Change()Dim FoundRegion As String FoundRegion = DLookup(“ [Region]”,“ [Area]”,“'[Area]![Area] = [Area]'”)Me.Region = FoundRegion End Sub

Private Sub Phone_Number_AfterUpdate() Dim FoundIMSI As Double FoundIMSI = DLookup("[IMSI ]", "[phones]", "'[phones]![Phone Number]=[Phone Number]'") Me.IMSI = FoundIMSI End Sub 私有子Phone_Number_AfterUpdate()将FoundIMSI设置为Double FoundIMSI = DLookup(“ [IMSI]”,“ [phones”“,”'[phones !! [电话号码] = [电话号码]'“)Me.IMSI = FoundIMSI End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM