Sql reorder

Posted on 2007-07-24
Last Modified: 2012-06-27
Hi Experts

My sql when debugged produces an sql string which has the closing colon and   parenthesis on line two as below:

SELECT [PartID],[Part_Description],[Comment],[PHeight],[PDepth], [PWidth][PWeight] FROM dbo_packaging  WHERE ([custid] ='Noby0001') and ([partid] = '7896535

Partid is a string and the query produces no rows if I paste the sql into a query pane and recreate the query so that the end of the sql looks like:

and ([partid] = '7896535)

The query produces rows. How do I reproduce this in my sql statement?

Mysql = mySQL = "SELECT [PartID],[Part_Description],[Comment],[PHeight],[PDepth], [PWidth][PWeight] FROM dbo_packaging " & _
        " WHERE ([custid] ='" & strTag & "')" _
        & " and ([partid] = '" & sSeltxt & "'" & _

Question by:JoeBo747
    LVL 8

    Accepted Solution

    Mysql = mySQL = "SELECT [PartID],[Part_Description],[Comment],[PHeight],[PDepth], [PWidth][PWeight] FROM dbo_packaging " & _
            " WHERE ([custid] ='" & strTag & "')" _
            & " and ([partid] = " & sSeltxt & ")

    try this
    LVL 1

    Author Comment

    Hi sabeesh:

    Well spotted, Thanks.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
    Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now