1

我不知道为什么我不能将AccountType(from TblAccount) 的值传递给Me.txtWAccounType(textbox from WithdrawView)。

请帮助我,这是我的代码

If IsNull(DLookup("[AccountId]", "TblAccount", "AccountId = '" & txtWAccountId & "'")) Then
 MsgBox "Account Number Doesn't Exist"

 Else
 Me.txtWAccounType.Value = DLookup("[AccountType]", "TblAccount", "AccountId = ' " & Forms![WithdrawView]![txtWAccountId] & "' ")
 MsgBox "Account Number Do Exist"

 End If

我的目标是检索 的那个AfterUpdateAccountId. messagebox但是弹出一个“帐号是否存在”,所以这意味着有一个值,但为什么它没有出现在 中 Me.txtWAccounType

4

1 回答 1

1

问题是因为没有符合条件的记录。如您所知,“123”和“123”之间存在差异,即根据您的代码在数字前有一个“空格”字符。只需替换 DLookUp如下..

DLookup("[AccountType]", "TblAccount", "AccountId = '" & Forms![WithdrawView]![txtWAccountId] & "'")
于 2012-10-22T09:55:58.937 回答