Explore BrainMass

Explore BrainMass

    Using a semicolon (;) in MS Access

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    I notice when writing queries that Access will add in a semicolon at the end of my query. Its just one of those Access things right? We don't have to remember to write the semicolon, as Access adds it in for us correct.

    The only time this is significant to know is in a situation like this - in a UNION query We may end up cutting and pasting code from 2 queries together, like this:

    So does that mean if we wanted to use a semicolon in our query search
    string, we would have to enclose it like you do an asterisk [;], or is
    using the double quotes enough?

    For example:
    SELECT *
    SELECT *

    if you were to accidentally do this:
    SELECT *
    FROM TABLE1; (<- leave in the semicolon from the first query)
    SELECT *

    Then your query wouldn't run. You can only have one semicolon in a query in Access, and it has to be at the end.

    © BrainMass Inc. brainmass.com March 4, 2021, 7:55 pm ad1c9bdddf

    Solution Preview

    Yes, Access will (depending on the version you are using) add the semicolon for you as well as reformat your query (in some cases).

    The ";" is supposed to mark the end of the query. In that case the union query that you are showing should fail. Instead, ...

    Solution Summary

    In SQL a semicolon (;) is intended to end a SQL statement. MS Access handles this a bit differently. This solution briefly explains how MS Access handles the ; and explains the advantages of using a ; the way it was intended.