Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8621965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:56:24+00:00 2026-06-12T06:56:24+00:00

Tried every combo I can think of: String.Empty, IsDBNull. selectPONumber is passed to ByVal

  • 0

Tried every combo I can think of: String.Empty, IsDBNull.

selectPONumber is passed to “ByVal selectPONumber() As String” from “selectPONumber: [‘ + JSON.stringify(”) + ‘]”

The StackTrace point to the second line of this VB

VB

    If Not IsDBNull(selectPONumber) Then
        If selectPONumber.Length > 1 Then
            qry = qry + "and ("
            For u As Integer = 0 To selectPONumber.Length - 1
                If u <> selectPONumber.Length Then
                    qry = qry + "and B.PONumber = '" & selectPONumber(u) & "' or "
                Else
                    qry = qry + "and B.PONumber = '" & selectPONumber(u) & "'"
                End If
            Next
            qry = qry + ") "
        Else
            qry = qry + "and B.PONumber = '" & selectPONumber(0) & "' "
        End If
    End If

Many thanks in advance!

Update

Replaced all lengths with counts, and took tranceporter’s advice. Now, it gives the same error on the “for” line. How did it make it past the If selectPONumber.Length > 1 ?

Updated Code

    If selectPONumber IsNot Nothing AndAlso selectPONumber.Count > 1 Then
            qry = qry + "and ("
            For u As Integer = 0 To (selectPONumber.Count - 1)
                If u <> selectPONumber.Count Then
                    qry = qry + "B.PONumber = '" & selectPONumber(u) & "' or "
                Else
                    qry = qry + "B.PONumber = '" & selectPONumber(u) & "'"
                End If
            Next
            qry = qry + ") "
    ElseIf selectPONumber(0) <> "" Then
        qry = qry + "and B.PONumber = '" & selectPONumber(0) & "' "
    End If

Solution

tranceporter’s solution is correct. I stupidly treated a regular string as an array elsewhere in my code. It started pointing all over the rest of the function as indexoutofbounds.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:56:25+00:00Added an answer on June 12, 2026 at 6:56 am

    try using this (unless you already have)

    If selectPONumber IsNot Nothing Then
        If selectPONumber.Count > 0 Then
           qry = qry + "and ("
            For u As Integer = 0 To selectPONumber.Count - 1
                If u <> selectPONumber.Count Then
                    qry = qry + "B.PONumber = '" & selectPONumber(u) & "' or "
                Else
                    qry = qry + "B.PONumber = '" & selectPONumber(u) & "'"
                End If
            Next
            qry = qry + ") "
        Else
            qry = qry + "and B.PONumber = '" & selectPONumber(0) & "' "
        End If
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried every combo I can think of / found and no matter
I have tried every way I can think of with this, but just not
I have tried every install method I can think of to install RPy2 on
I've tried every thing I can think of and I can't figure out how
I've tried every combination I can think of in terms of how to configure
I've tried every Google search term I can think of but everything I dig
I'v tried every way I can think of, but for the life of me
I've tried every variation I can think of for input type and raw input
This is my code... i've tried every path-format I can think of to get
I think I've tried every combination, but I can't get the alpha keyboard to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.