Results 1 to 6 of 6
  1. #1
    greatwhite is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2019
    Location
    Ottawa, ON
    Posts
    56

    Order By "Invalid use of Null"

    I have this query in MS Access and when I add an order by I receive the error "Invalid use of Null" it works fine if I exclude the Order by. Any suggestions

    SELECT tblEquip.keyEquip, tblEquip.keyShip, tblEquip.strFPN, tblEquip.keyCmpt, tblEquip.strLoc, tblEquip.strID, tblEquip.strEquipType, tblEquip.strDescription, tblEquip.strNotes, strOldValue, strNewValue
    , tblAuditTrail.strChangeType, tblAuditTrail.strTableName, tblAuditTrail.numRecordID
    FROM tblEquip INNER JOIN tblAuditTrail ON (tblEquip.keyEquip =CLng(tblAuditTrail.strOldValue))
    where strfieldName = 'keyEquipDn'

    order by strOldValue

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Have you tried using Nz(strOldValue)

  3. #3
    greatwhite is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2019
    Location
    Ottawa, ON
    Posts
    56
    Yes just tried it now and same response also tried CLng. There are no Nulls

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Have you done a Compact and Repair lately?

  5. #5
    greatwhite is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2019
    Location
    Ottawa, ON
    Posts
    56
    Yes, I'm thinking it is a limitation in MS Access pretty sure I can do this in SQL Server.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    I would still try *importing* your db into a fresh new db before giving up. It only take a minute and would leave any possible corruption behind.

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

Similar Threads

  1. Replies: 6
    Last Post: 03-06-2019, 12:01 PM
  2. Replies: 6
    Last Post: 04-16-2018, 10:38 AM
  3. Replies: 3
    Last Post: 11-13-2013, 08:56 AM
  4. StrComp causing "Invalid use of Null" error
    By sephiroth2906 in forum Programming
    Replies: 5
    Last Post: 09-15-2011, 07:06 PM
  5. Update query from form "invalid use of null"
    By Lady_Jane in forum Programming
    Replies: 4
    Last Post: 08-16-2011, 01:37 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