Results 1 to 9 of 9
  1. #1
    Bkndbrown is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2015
    Posts
    22

    linking to a query with a calculated field

    I have queries with calculated fields. Such as count a field on a table or concatenating a string together. It works just fine and I can sort no problems. When I link to it on a form I cannot sort by that field anymore. I get either syntax error (missing operator) in query expression.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    What method are you using to sort? You are applying sort criteria to form? In the RecordSource SQL?

    I cannot replicate issue.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    Bkndbrown is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2015
    Posts
    22
    I have attached a way stripped down version of the database with one record of fictional data
    Attached Files Attached Files

  4. #4
    Bkndbrown is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2015
    Posts
    22
    The error is on the form if you click the down arrow to sort.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    A little hard to test sorting with only one record.

    Not seeing any sort parameters in queries or form design.

    What is purpose of this form? Why does its RecordSource include tables and queries? Usually, a form can do data entry/edit for only one table. Data in aggregate queries cannot be edited. Perhaps you should be build a report.
    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.

  6. #6
    Bkndbrown is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2015
    Posts
    22
    It will be a split form with a datasheet on top with a bunch of data shown then when you select a record it will select that record on a subform where I will do data entry for one record in one table. However it would be nice if I could select the drop down to perform a sort or search for one name or other parameter without an error.

    I realize that it would be easier to do a sort with more data but it sorts A to Z just fine my purpose was to show the error that I receive and the structure.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    What error? What should I do to trigger error? I tried the ribbon and right click shortcut menu sorts and both work.
    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.

  8. #8
    Bkndbrown is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2015
    Posts
    22
    Open the form then click on the drop down arrow next to the "name" column header of the datasheet where you would click if you wanted change the sort option for the table or if you wanted to filter the table down to one record. You can do this with all threemi of the columns and you get the same error. The error is "syntax error (missing operator) in query expression"

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Okay, got that. The error pops up and I just click OK, the popup closes and the sort options open.

    Change the queries so the alias names do not have spaces.

    The OutputSheet query is not needed. Sponsor should be unique in SponsorDataT - GROUP BY is not needed.

    Change the form RecordSource query to:

    SELECT SponsorDataT.PersonalID, AdultDepQ.CountOfPersonalID AS AdultDep, MinorDepQ.CountOfPersonalID AS MinorDep, [SponsorLastName] & ", " & [SponsorFirstName] & " " & [SponsorMiddleInitial] AS FullName FROM (SponsorDataT LEFT JOIN AdultDepQ ON SponsorDataT.PersonalID = AdultDepQ.PersonalID) LEFT JOIN MinorDepQ ON SponsorDataT.PersonalID = MinorDepQ.PersonalID;
    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: 2
    Last Post: 12-30-2014, 01:32 PM
  2. Replies: 1
    Last Post: 08-25-2014, 01:23 PM
  3. Calculated Field in Query
    By roarcrm in forum Queries
    Replies: 1
    Last Post: 06-06-2014, 09:24 AM
  4. Replies: 4
    Last Post: 03-20-2014, 03:52 PM
  5. Replies: 3
    Last Post: 02-13-2013, 10:15 AM

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