Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    roonierella is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    9

    Invalid bracketing of name in a crosstab parameter query

    Hello.

    I am working in Access 2010 and have setup a crosstab query. I want to use parameters and have setup a form from which the parameters will reference. Instead of the parameters being prompted through pop-ups, I want the query to use the open form as a reference. When in the query, I I key in the parameters and attempt to run the query, I receive the following message:

    Invalid bracketing of name 'Between [Forms]![frmContactsBySSS]![StartDate] And [Forms]![frmContactsBySSS]![EndDate]'.

    Any suggestions on what I am doing wrong?

    Thanks.

  2. #2
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    Are [StartDate] and [EndDate] text boxes or combos? If they are it should be:
    Between [Forms]![frmContactsBySSS].[StartDate] And [Forms]![frmContactsBySSS].[EndDate]

  3. #3
    roonierella is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    9
    They are text boxes. If I key what you suggested (Between [Forms]![frmContactsBySSS].[StartDate] And [Forms]![frmContactsBySSS].[EndDate]) I get the same message.

  4. #4
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    Well that's right so post your SQL, it case the error is actually somewhere else.

  5. #5
    roonierella is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    9
    PARAMETERS [Forms]![frmContactsBySSS]![SSSName] Text ( 255 ), [Between [Forms]]![frmContactsBySSS].[StartDate] And [Forms]![frmContactsBySSS].[[EndDate] ] DateTime;
    TRANSFORM Count(tblContactLog.ContactID) AS CountOfContactID
    SELECT tblContactLog.StudentNameID, Count(tblContactLog.ContactID) AS [Total Contacts]
    FROM tblContactLog
    GROUP BY tblContactLog.StudentNameID, tblContactLog.ContactDate
    ORDER BY tblContactLog.StudentNameID
    PIVOT tblContactLog.ContactType;

  6. #6
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    Oh my god I'm so sorry you were right before(about the ! not .), I'm a little tired...

    So I haven't really used cross tab tables, but I just make a quick simple one, adding criteria, and it came up as usual under WHERE, not PARAMETERS, how did you get that?
    What I did was to select what I want to add my criteria to, total as where, and then add the criteria to that column
    From what little I got from making a sample one... Why do you have count(contractID) in both the value and the row heading?

    I'm thinking I might not know the answer to your question... Sorry!

  7. #7
    roonierella is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    9
    I appreciate your help.

    Let me explain this a different way (I just re-evaluated my query).

    I have a table to track contacts that staff members make with students. I want a crosstab query with the the student's name in the row heading [StudentNameID] and the type of contact made [ContactType] in the column headings. I want the query to count the number of records under each contact type (count of [ContactID]) to give the the number of contact types per student. Each student record in the contact log can only have one contact type, which is why I am counting the ContactID (my primary key value). I want one version of this query to have parameters set to only show data within a date range (between [StartDate] AND [EndDate]). I want a second version of the query that does the same thing, but with the name of the person who made the contacts [SSSName] as the first parameter and the dates as the second parameter.

    The key is that I want to have the parameter portion executed through the form instead of the standard pop-up windows. It will be easier on the people who will be using the database if I do it this way.
    Last edited by roonierella; 08-23-2013 at 09:24 AM. Reason: spelling

  8. #8
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    So this is what I came up with:
    Obviouly you'll have to make a form

    For the query, something like this, the last 2 fields can be for their own qeury
    Click image for larger version. 

Name:	Capture3.PNG 
Views:	12 
Size:	10.9 KB 
ID:	13550
    I don't have your data so I can't test it out but I think it should work, obviouly ignore the Exp1.. things
    For the Where with SSSName, I don't know if you're using a combo or not but I added the wildcards so you can search for any part of the name

    Make sure on your form to format the enter date text boxes, so that the dates are in the same format as the data

  9. #9
    roonierella is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    9
    That is very close to what I did. The SSSName is not a visible field; the entire database itself is for a school, and then a person(s) are assigned to that school. The form I set up had a combo box/list linking to the SSSNames already keyed in the database.

    Click image for larger version. 

Name:	Form_Fields.png 
Views:	7 
Size:	9.7 KB 
ID:	13551

  10. #10
    roonierella is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    9
    OH! I don't know what I did but I got it to work. Thank you SO MUCH FOR YOUR HELP!!!! The query works when I access it through the form. I have a feeling once I dig deeper I may have another question. LOL

  11. #11
    roonierella is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    9
    Actually, I spoke too soon. I took out the SSSName and focusing just on the dates.

    Click image for larger version. 

Name:	Query.png 
Views:	9 
Size:	39.0 KB 
ID:	13552

  12. #12
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    How are you typing in the names? If it pops up automatically then there should be no reason for it to no be recognized. This may sound silly but did you name the text boxes?

    Also, did this same query work before?

  13. #13
    roonierella is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    9
    They names come in up a combo list - they select the names in the form prior to keying in the dates.

    I thought it worked because when I clicked "OK" on the form. But, to test, I added another record with someone elses name and I realized the query wasn't applying the parameters. I had to key back in and when I did, I got the error message.

    Are you talking about the text boxes on the form? Yes, I named them; StartDate and EndDate.

  14. #14
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    So what exactly is happening? The records are not being filtered? Is the format of the query correct?
    I re-read the error message is is says "field or expression" both of which it is not supposed to be, it's not even in that row...
    Try entering real dates (Between #1/1/2000# And #12/12/2013#) play around with that to see if that works. Maybe it has something to do with the form properties.

    When you say added another record, does that mean you don't have data? If not I would make a quick set of sample data so that you can actually test the db.

  15. #15
    roonierella is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    9
    Actually, it will not let me run a parameter in the criteria field for ContactDate, period. *sigh*

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

Similar Threads

  1. VBA Error: Invalid Bracketing of Name
    By kawi6rr in forum Programming
    Replies: 3
    Last Post: 02-21-2013, 05:26 PM
  2. Replies: 13
    Last Post: 12-12-2012, 08:17 PM
  3. Crosstab Query Parameter
    By BLD21 in forum Queries
    Replies: 1
    Last Post: 06-06-2011, 09:08 AM
  4. Replies: 3
    Last Post: 04-12-2011, 10:22 AM
  5. Parameter in Crosstab Query
    By RandyG in forum Queries
    Replies: 4
    Last Post: 09-30-2009, 06:40 AM

Tags for this Thread

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