Results 1 to 10 of 10
  1. #1
    Shilabrow is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    May 2014
    Posts
    34

    Incorrect Column expression Error when I use Is Null or Yes Criteria.

    I get the error Incorrect Column expression .... when I use the ( Is Null or "Yes" ) as criteria. The issue is the error only occurs when I import records/data using MS Query connection to Excel from Access but when I use the query in Access, I get the result without error. Is there a different way to query for yes or blank criteria and successfully get my query out to excel without error. All help appreciated. Thanks much!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    What do you mean by 'import query using MS Query connection to Excel from Access'? Do you mean import records?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Shilabrow is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    May 2014
    Posts
    34
    yes - sorry import record or data. All help appreciated. Thanks!

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Okay, now I don't understand using criteria for an import. What do you mean by 'MS Query connection to Excel'? What do you mean by 'get query out to Excel'? Apparently I have never done anything like what you are trying to describe.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Shilabrow is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    May 2014
    Posts
    34
    I am trying to import data to excel from access. The query works at first and I get data imported successfully into Excel but when I use the criteria where WHERE (((Products.Category) Is Null Or (Products.Category)="oil")) that is when the error comes up as "Incorrect Column expression".

    SELECT Orders.[Order Date], Products.[Product Name], Products.Category, [Quantity]*[Unit Price] AS Amount
    FROM Orders INNER JOIN (Products INNER JOIN [Order Details] ON Products.ID = [Order Details].[Product ID]) ON Orders.[Order ID] = [Order Details].[Order ID]
    WHERE (((Products.Category) Is Null Or (Products.Category)="oil"))
    ORDER BY Orders.[Order Date], Products.[Product Name];

    Is there another way to query Is null or Oil so that I can avoid the error or what am I doing wrong. Thanks June7 for your help - I appreciate this.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    You want to export from Access to Excel?

    No idea. The query looks fine to me. I have known Excel to choke on Nz() used in expressions in Access query but your criteria should work.

    Your original post said criteria would be "Yes" - not seeing that in your SQL.

    Did you try with just one of the criteria at a time?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Shilabrow is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    May 2014
    Posts
    34
    Yes the criteria works if used one at a time, But when I combine the two that is when I get the error. Also I notice that I get error importing when parameters are used such as "between and" for dates. Thanks June, I was just wondering if there is a different way to pull the same data and changing the criteria so that I can still get my Oil and Null data.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I tested exporting query that had multiple criteria like yours and it worked without error. Used the Access Export wizard.

    Also tested with BETWEEN AND on a date field and that works.

    Cannot replicate the issue.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Shilabrow is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    May 2014
    Posts
    34
    I see you mentioned Access Export Wizard, I use the Excel MS Query connection. I have never tried exporting from Access - Is there a link you can refer me to as to try this from Access (Step By Step)? I appreciate your relentless effort in helping me get result I want. Thanks!



    Quote Originally Posted by June7 View Post
    I tested exporting query that had multiple criteria like yours and it worked without error. Used the Access Export wizard.

    Also tested with BETWEEN AND on a date field and that works.

    Cannot replicate the issue.

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    So you were using Excel to pull data from Access and not pushing the data out from Access? I've only experimented with linking from Excel side, nothing implemented.

    Try searching Access Help or Bing for info on Access export wizard. That's what I would have to do to get you a referral.

    Or click the ribbon and experiment. Look at the External Data tab.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 06-28-2013, 12:15 PM
  2. Replies: 1
    Last Post: 05-02-2013, 01:29 AM
  3. Replies: 1
    Last Post: 05-11-2012, 10:59 AM
  4. Expression Incorrect in TOTALS query
    By SenSen in forum Queries
    Replies: 0
    Last Post: 02-29-2012, 08:46 PM
  5. Replies: 1
    Last Post: 02-23-2012, 02:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums