I am working on a VBA macro to import to AP invoices. The environment is version 6.0A.
The code breaks on the .Browse line, only when the invoice number has space, e.g. strInvoiceNumber = "2345 Summer Break". The session error returned is "- Criteria error. Syntax error. Invalid boolean."
But Accpac invoice number field allows space when enter manually. Is there a fix?
'-------- validate document number, type and vendor
strDocType = Trim(.Fields("Type"))
strInvoiceNumber = Trim(.Fields("InvoiceNumber")) '& "AAA"
vAPIBH.Init
vAPIBH.Browse "IDVEND=" & Chr(32) & strVendorID & Chr(32) & " AND IDINVC=" & Chr(32) & strInvoiceNumber & Chr(32) & " AND TEXTTRX =" & strDocType, True
If vAPIBH.Fetch = True Then
Print #1, "Data Error (Routine: ComanyInvoices): Company: " & strCompanyDesc & " Vendor ID: " & strVendorID & " Document Number: " & strInvoiceNumber & " Type: " & strDocType & " already exist."
intErrorValidate = intErrorValidate + 1
intErrorCount = intErrorCount + 1
End If
Thanks
The code breaks on the .Browse line, only when the invoice number has space, e.g. strInvoiceNumber = "2345 Summer Break". The session error returned is "- Criteria error. Syntax error. Invalid boolean."
But Accpac invoice number field allows space when enter manually. Is there a fix?
'-------- validate document number, type and vendor
strDocType = Trim(.Fields("Type"))
strInvoiceNumber = Trim(.Fields("InvoiceNumber")) '& "AAA"
vAPIBH.Init
vAPIBH.Browse "IDVEND=" & Chr(32) & strVendorID & Chr(32) & " AND IDINVC=" & Chr(32) & strInvoiceNumber & Chr(32) & " AND TEXTTRX =" & strDocType, True
If vAPIBH.Fetch = True Then
Print #1, "Data Error (Routine: ComanyInvoices): Company: " & strCompanyDesc & " Vendor ID: " & strVendorID & " Document Number: " & strInvoiceNumber & " Type: " & strDocType & " already exist."
intErrorValidate = intErrorValidate + 1
intErrorCount = intErrorCount + 1
End If
Thanks