无法在与请求的名称或序号对应的集合中找到item

时间:2016-08-10 03:50:14

标签: sql vb.net ms-access crystal-reports qodbc

我的代码出现以下错误。我怎么能纠正这个?

  

在与所请求的名称或序号相对应的集合中找不到项目

ElseIf Me.chkItem.Checked = True Then
    Dim CheckNumber As String = ""
    Dim CheckRef As String = ""
    dsvoucheritem.Clear()
    DSVoucher_Expense.Clear()
    DSVoucher_Check.Clear()

    Try
        Me.lstCV.Items.Clear()
        strDiscount = Nothing
        rec.Open("select billpaymentcheckline.txnnumber, billpaymentcheckline.txndate" _
        & ", billpaymentcheckline.payeeentityreffullname" _
        & ", billpaymentcheckline.amount, billitemline.itemlineitemreffullname" _
        & ", billitemline.memo" _
        & ", billpaymentcheckline.appliedtotxndiscountamount" _
        & ", billpaymentcheckline.appliedtotxnrefnumber, billpaymentcheckline.bankaccountreffullname" _
        & ", billpaymentcheckline.appliedtotxndiscountaccountreffullname" _
        & ", billpaymentcheckline.appliedtotxntxndate, billpaymentcheckline.appliedtotxnamount" _
        & ", billpaymentcheckline.refnumber, account.AccountNumber from (billitemline inner join" _
        & " billpaymentcheckline on billitemline.refnumber=billpaymentcheckline.appliedtotxnrefnumber) left outer join" _
        & " account on billitemline.APAccountreflistid=account.listid where" _
        & " billpaymentcheckline.bankaccountreflistid='" &Me.lblBankID.Text & "' and" _
        & " billpaymentcheckline.refnumber between '" & CInt(Me.txtRefFR.Text)
        & "' and '" & CInt(Me.txtRefTO.Text) & "'", con, ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockReadOnly)

2 个答案:

答案 0 :(得分:0)

它说它不能识别你的一个列名。仔细检查所有这些。你也可以尝试删除字段,直到找到罪魁祸首。

答案 1 :(得分:0)

memo是Access SQL中的reserved word

尝试billitemline.[memo]