Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234

    Getting "Invalid bracketing of name" error.

    Similar to my other post here, http://bit.ly/1TMiCP1, I'm trying to get a total. On the special event form, post event sub form, I have a textbox in which I type in the actual number of cars parked in a garage, and another in which I type in actual number of cars parked in a lot. These textboxes are named Actual#CarsGarage and Actual#CarsOutside, respectively. Where I want this total displayed is in an unbound textbox on another, related form, the client form.



    The control source of the unbound textbox is a query named qryClientEvent. In qryClientEvent, I entered this into a column: Expr1: Sum([EventID]![tblEvent.Actual#CarsGarage]+[tblEvent.Actual#CarsOutside]).

    When I try to go back to form view, I get the error message "Invalid bracketing of name [EventID]![tblEvent.Actual#CarsGarage]"

    Here are a few pictures to illustrate:Click image for larger version. 

Name:	New query.png 
Views:	8 
Size:	10.7 KB 
ID:	21352Click image for larger version. 

Name:	SE form.png 
Views:	8 
Size:	40.3 KB 
ID:	21353Click image for larger version. 

Name:	Client form.png 
Views:	8 
Size:	45.8 KB 
ID:	21354

  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,770
    Why is EventID! prefixing the first term? A field would never be prefix.

    Drag a field to design grid or double click to send it to grid to view how the query will reference. Probably just need:

    Sum([Actual#CarsGarage] + [Actual#CarsOutside])
    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
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    That's what I initially tried, but I got the error message: "You tried to execute a query that does not include the specified expression 'EventID' as part of an aggregate function"

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Post the entire SQL statement. It doesn't look like an aggregate query in the image and it couldn't be for a data entry form.

    As you said, similar issue to your other thread. Same concept. Calculate with aggregate functions in textbox placed in form footer.

    Query should probably be:

    AliasFieldNameHere: [Actual#CarsGarage] + [Actual#CarsOutside]

    Then textbox in form footer:
    =Sum([AliasFieldNameHere])
    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
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    I'll give that a try, but it's fairly important not to have this be tallied up in the form footer, but in the unbound textbox, inline with the rest of the information for the particular event.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Isn't that what the simple addition of the two fields does?

    However, arithmetic with null results in null. If either field is null the calc will result in null. Need to handle possible null. That or just show raw data on form and let people do simple addition in their heads.

    Do more complex calcs on reports.
    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
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    Ok, I got it all working. I just had to use the code you gave, and tweak the column size.

    Thanks!!

  8. #8
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    The way I handled the possibility of null is that I set the default value as zero. Now it won't be left blank.

  9. #9
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    Though I may have spoken too soon. I set the default value as zero, but it's not displaying a zero..

  10. #10
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    One last question. On the query, in the column that has Actual#CarsOutside and Garage, if I want to say "If null, =0," How do I word that so that the query accepts it and applies it?

  11. #11
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    Quote Originally Posted by June7 View Post
    That or just show raw data on form and let people do simple addition in their heads.

    I like this idea better... Would the easiest way to do this simply be to put Cars Parked: [Actual#CarsGarage] "&" [Actual#CarsOutside]?

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Either 2 textboxes to display the individual values or:

    ="Garage: " & Nz([Actual#CarsGarage], 0) " & Outside: " & Nz([Actual#CarsOutside], 0)

    Review http://allenbrowne.com/QueryPerfIssue.html

    Are users supposed to do data entry into these two fields?

    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.

  13. #13
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    FYI: "Index" and "Date" are reserved words in Access and shouldn't be used as object names. You will have headaches..... "Date" is also an intrinsic function.

    You should only use letters, numbers and the underscore in object names. No spaces, punctuation of special characters.

    "#" is a delimiter for dates. Having "#" in an object can/will confuse Access. Should use "Num" or "No".

    In table "tblRelEventEmployee" you have a field named "Mgr?" a better name would be "IsMgr".

  14. #14
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    Quote Originally Posted by June7 View Post

    Are users supposed to do data entry into these two fields?
    Yes. Every couple days or so, we process reports, and enter values into these fields.

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Then aren't there already two textboxes for input of this data? Why bother with the expression to show these two values in one textbox?
    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.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 09-08-2014, 06:07 PM
  2. Replies: 5
    Last Post: 06-26-2013, 02:29 PM
  3. Replies: 4
    Last Post: 06-24-2013, 07:12 AM
  4. Replies: 13
    Last Post: 12-05-2011, 05:10 AM
  5. StrComp causing "Invalid use of Null" error
    By sephiroth2906 in forum Programming
    Replies: 5
    Last Post: 09-15-2011, 07:06 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