Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    JGrots is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Jan 2013
    Posts
    65

    Training Database Design Help

    Hello All,



    I'm working on training database for all employees. I have a form (single form) that shows all employee names. For each employee I want to be able to pick as many training categories as I want from a drop down combo box. Depending on the training categories I want the all topics to show up in another subform along with a DateTrained field so that I can record the date the employee was trained on that individual topic.

    I created four tables: Employees Table, Categories Table, Topics Table and a Training Table



    I'm having a problem getting the correct topics to display for the selected employee once I select my categories and I'm not able to enter in data in the DateTrained field. I don't want to have to select each topic one by one.

    I have attached my database. Any help will be greatly appreciated. Thank you!Training Database Test.mdb

  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,632
    Why is Employees table not included in the Relationships builder?

    Why is Category related to both TrainingTable and TrainingTopics? I think category should be in TrainingTopics only.

    Categories are not related to employees so having that subform does not make sense.

    Need to set the Master/Child links for the TrainingTopics subform. Review http://office.microsoft.com/en-us/ac...010098674.aspx
    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
    JGrots is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Jan 2013
    Posts
    65
    Thanks, June7 for the help.

    I don't want to pick each TrainingTopic individually for each employee. I want to be able to pick the Category which then pulls in all the training topics that are associated with it. At that point then I can record the training date for each topic. How do I do this without using a categories subform?

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    You could use Cascading combo where list of categories is displayed.
    You pick the one of interest, then next combo shows only the topics for the selected Category.

    research Cascading Comboboxes MsAccess

  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,632
    What orange suggests is a way to limit the training topics combobox list but you still have to select desired topic and create the record.

    If you want to batch create a set of training topic records and then just manually fill in the date, that will require code running an INSERT SELECT sql action.
    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
    JGrots is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Jan 2013
    Posts
    65
    June7,

    Is there anyway you can elaborate on the INSERT SELECT coding or provide an example?

  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,632
    In VBA, like:

    CurrentDb.Execute "INSERT INTO TrainingTable (EmployeeID, CategoryID, TopicsID) SELECT " & Me.EmployeeID & " AS EmployeeID, CategoryID, TopicsID FROM TrainingTopics WHERE [Required Training] <> 'N/A'"
    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
    JGrots is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Jan 2013
    Posts
    65
    I have a screenshot of how I want to get all the topics to input into the TrainingTopics Table.

    Click image for larger version. 

Name:	Screenshot.jpg 
Views:	14 
Size:	97.2 KB 
ID:	15543
    For each employee, I want to highlight a category then click on the execute button and have all the topics for that category input into the TrainingTopics Table.
    Here is the code I have thus far, but it's not working:

    CurrentDb.Execute "INSERT INTO TrainingTable (EmployeeID, CategoryID, TopicsID) SELECT " & Me.EmployeeID & " AS EmployeeID, " & Me.CategoryName & " AS CategoryID, TopicsID FROM TrainingTopics WHERE [Required Training] <> 'N/A'", [CategoryID] = " & Me.CategoryName & "

  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,632
    Is the value of the listbox actually the text description or is there an ID field?

    Try:

    WHERE [Required Training] <> 'N/A' AND [CategoryID] = '" & Me.CategoryName & "'"

    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.

  10. #10
    JGrots is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Jan 2013
    Posts
    65
    It is bound by the ID field. I tried your changes but I keep getting an error: Run-time error '3061' Too few parameters. Expected 2.

    I've reattached an updated version of the DB.

    Training Database Test.mdb

  11. #11
    JGrots is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Jan 2013
    Posts
    65
    I was able to get it to work. Here is the updated code:

    CurrentDb.Execute ("INSERT INTO TrainingTable (EmployeeID, TopicsID) SELECT " & Me.EmployeeID & " AS EmployeeID, TopicsID FROM TrainingTopics WHERE CategoryID = " & Me.CategoryName)

    I have another question to ask now. What code do I use so that a topic and can only be added to the TrainingTable for a given employee once? I don't want there to be any duplicates for the same employee.

  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,632
    CategoryID is not a field in TrainingTable.

    The value of listbox is number ID so remove the apostrophes.

    Remove the s from TopicsID in the SELECT statement. There is an s in TopicsID for TrainingTable, but not for TrainingTopics.

    The actual name of RequiredTraining field does not have a space. The caption has a space. This is why I never set these properties in table. They just add confusion.

    CurrentDb.Execute "INSERT INTO TrainingTable (EmployeeID, TopicsID) " & _
    "SELECT " & Me.EmployeeID & " AS EmployeeID, TopicID " & _
    "FROM TrainingTopics WHERE RequiredTraining <> 'N/A' AND [CategoryID] = " & Me.CategoryName
    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
    JGrots is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Jan 2013
    Posts
    65
    Thanks June7. I realized the TopicsID were different so I changed the TopicID in the TrainingTopics to TopicsID.

    I'm trying to make sure that multiple copies of a category/topic can't be inputting for the same employee. Here is the code I have but I keep getting a runtime error 424 object required.

    If Query1.EmployeeID <> Me.EmployeeID And Query1.CategoryID <> Me.CategoryName Then

    CurrentDb.Execute ("INSERT INTO TrainingTable (EmployeeID, TopicsID) SELECT " & Me.EmployeeID & " AS EmployeeID, TopicsID FROM TrainingTopics WHERE CategoryID = " & Me.CategoryName)

    End If

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Can't refer to a table or query directly like that. Have to open a recordset filtered to the values and check the recordset content or use DLookup. However, you would have to check every single EmpID/TopicsID pairing. Not practical with this batch INSERT.

    Remove the outer parens from the Execute code.

    Why did you remove the RequiredTraining parameter?
    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.

  15. #15
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    I have another question to ask now. What code do I use so that a topic and can only be added to the TrainingTable for a given employee once? I don't want there to be any duplicates for the same employee.
    You create a unique composite index of the fields whose combination you only want 1 time.

    Sounds like TopicId,EmployeeID would be the fields in your unique composite index.

    research "unique composite index" with search.

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

Similar Threads

  1. How to Create a Training Database
    By jmansfield in forum Access
    Replies: 3
    Last Post: 02-03-2014, 02:56 PM
  2. Training Database - Need more help from JZWP11
    By Harley Guy in forum Access
    Replies: 1
    Last Post: 03-13-2013, 08:42 AM
  3. Training Database
    By BISCUITPUMPER in forum Access
    Replies: 11
    Last Post: 08-20-2011, 10:15 AM
  4. training video database
    By bkvisler in forum Access
    Replies: 6
    Last Post: 08-24-2010, 09:51 AM
  5. Training Records Database
    By weisssj in forum Database Design
    Replies: 4
    Last Post: 04-21-2010, 03:36 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