想立即解决Access VBA相关问题

问题描述 投票:0回答:1

我想通过单击基于三个不同组合框(即客户类型、客户名称和现金票据编号。我创建了下面给出的代码并收到错误......请帮助。

代码:DoCmd.OpenReport "Invoice", acViewReport, , "[客户类型] = " & Me.ltyp 和 [客户姓名] = " & Me.lcnm 和 [现金凭证/税务发票编号] = " & Me .lmnum, acWindowNormal"

DoCmd.OpenReport "发票", acViewReport, , "[客户类型] = " & Me.ltyp 和 [客户姓名] = " & Me.lcnm 和 [现金凭证/税务发票编号] = " & Me.lmnum , acWindowNormal"

请解决我的问题。

ms-access ms-access-2010 ms-access-2007
1个回答
0
投票

您的代码错误。您必须区分文本和数字。假设[客户类型]和[客户姓名]是文本,[现金凭证/税务发票号码]是数字,它应该看起来像这样:

DoCmd.OpenReport "Invoice", acViewReport, , "[Customer Type] = '" & Me.ltyp & "' and [Name of the Customer] = '" & Me.lcnm & "' And [Cash Memo/Tax Invoice Number] = " & Me.lmnum, acWindowNormal

文本必须始终用引号引起来,数字则不必。

© www.soinside.com 2019 - 2024. All rights reserved.