Results 1 to 7 of 7
  1. #1
    khughes46 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Grapevine, TX
    Posts
    231

    DOn't know how to make multi-field primary key work.

    I need to create a student roll report that shows Campus Name (there are 6), the session or period (AM, MID, NT), the classroom or SectionNumber (1, 2, 3, 4, 5, 7, 10, 11), the date (I use dateadd so we can print ahead), and the name of the person taking the roll. I get all I need except the Roll Takers name to appear in my Rolls Query. The Roll Takers table has three fields for the primary key that I am trying to relate to the Student Schedule table (see the relationships). But I can't get it to work. I obviously don't know how to properly use a multi-field primary key. DB is attached. Please help.
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Relationship between RollTakers and StudentSchedule is wrong in the relationship builder.

    What you have is a compound key in RollTakers. This means need to have 3 links between StudentSchedule and RollTakers tables, not have StudentSchedule in the builder 3 times each with a separate link. One StudentSchedule table with 3 link lines to RollTakers.

    Remove the 2 extra StudentSchedule tables and set the 3 links to the one table. Linking in query should be the same.

    BTW, advise no spaces or special characters/punctuation (underscore is exception) in name convention.
    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
    khughes46 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Grapevine, TX
    Posts
    231
    Did that and still no names.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Campus_ID values are like 057828000. Cannot enter 1, 2, 3, 4, 5, 6 as parameter for the query. I used 057828002 and 30 as inputs and they worked.

    I never use dynamic parameterized queries. I have user enter parameter into control on form and reference control in VBA to construct filter criteria and apply to form or report when opening.

    DoCmd.OpenReport "Rolls Report", , , "CampusIDOfEnrollment='" & Me.cbxCampus & "'"
    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
    khughes46 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Grapevine, TX
    Posts
    231
    I use a wild card to get my campus *1 *2 *3 *4 *5 *6, that works fine, and the days ahead parameter can be any number (positive or negative). That all works fine. But I'm still not seeing names in the Rolls Query. If I get names there I'll have them for the report. What am I not doing that you are to get names?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    After being sidetracked by the relationship issue, I lost track of the main issue.

    The Campus_ID values in Roll Takers is only 8 characters. They are 9 characters in Campuses - there is a leading zero. CampusNumber field in Student Schedule has the 9-character version. No records from Roll Takers are matching the records in Student Schedule. Need to fix the data.
    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
    khughes46 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Grapevine, TX
    Posts
    231
    Oh the difference a digit makes! Thanks again!

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

Similar Threads

  1. Replies: 2
    Last Post: 08-31-2012, 02:20 PM
  2. Replies: 6
    Last Post: 06-05-2011, 09:30 AM
  3. Replies: 2
    Last Post: 01-03-2011, 05:17 PM
  4. Replies: 1
    Last Post: 09-29-2010, 08:01 AM
  5. Replies: 1
    Last Post: 06-01-2009, 01:09 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