Results 1 to 7 of 7
  1. #1
    neil123williams is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    16

    Combo Box Help

    8 years ago when I was developing a lot of access databases in 97 I could navigate through my problem fairly easily, but now with 2010 and not having developed a dbase in more then 5 years I'm struggling. If there is a sample dbase that would help me please share. Thanks in advance.



    Here's the Tables

    tbl_Assc_List
    fields: Emp_Name, Emp_Num, Emp_RFID

    tbl_Time_Entry
    fields:
    Emp_Name, Emp_Num, Emp_RFID, Task, Start_Date, Start_Time, End_Date, End_Time

    I want a form that allows my users to EITHER select Emp_Name OR Emp_Num from tbl_Assc_List in the header. If either is selected I want tbl_Time_Entry to have both fields populated based on values returned from the combo box in the header which looks at values in tbl_Assc_List.

    Then the user can enter the Task, Start_Date, Start_Time, End_Date, End_Time in the detail portion of the form.

    What I want is a form header where the associate is only selected once, and then multiple entries can be performed for the time records. Then when a new associate is needed the select "new record" and then select another associate and start the data entry process all over.

    Thanks!

  2. #2
    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,722
    ? In table tbl_Time_Entry why store the Emp_Name, Emp_Num, Emp_RFID. This is considered redundant and lacking Normalization.

    What is the unique identifier of an Employee. That would be the Primary key in
    tbl_Assc_List, and it would be used in tbl_Time_Entry (as a Foreign key).

    As for the form, the user could select by Name or Num or RFID, but it would put the PK in the
    tbl_Time_Entry . I would suggest 2 Calendar Controls, 1 to select Start Date/time and 1 for End Date/time. This way there's less chance of typos.


    Here's a link to video tutorial re comboboxes
    http://www.datapigtechnologies.com/f...combobox1.html
    http://www.datapigtechnologies.com/f...combobox2.html

    Here's video for Calendar control
    http://www.datapigtechnologies.com/f...drcontrol.html
    Just my $.02

  3. #3
    neil123williams is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    16
    Thanks for the response.

    The reason for Emp_Name, and Emp_RFID in tbl_Time_Entry is to allow searching of records for editing purposes without a known Emp_Num. Emp_Num is a keyed field in both tables.

    I apologize, but I don't understand the "PK in the tbl_Time_Entry" reference. Would tbl_Time_Entry be a subform to tbl_Assc_List? Then how do I build the reference to update tbl_Time_Entry? I feel like such a novice again....

    Yes a calendar control would be helpful, but 2010 took that away in form controls, so to speak, I have some old code to build it in if 2010 will support the ancient calendar control I use to use.

    Thanks again.

  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,722
    Here is an easy to read overview to get you some help with table design.
    It's a good reference.
    http://forums.aspfree.com/attachment...achmentid=4712

  5. #5
    neil123williams is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    16
    Reading it now, good reference material and some rules I tend to break:-/ Got the PK reference.

    I see how removing name and RFID will help. Now, how do I create the form where Emp_Name, Emp_Num, OR Emp_RFID is selected and then populates the Emp_Num field in tbl_Time_Entry and subsequently allows multiple time entries? I have done this in the past, have read a hundred thread and just cant stop beating my head on my monitor. Access 2010 is really taking some time for me to get use to.

  6. #6
    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,722
    Now I don't have Acc2010, so there may be some differences. I'm using my table so field names don't match yours but it's the concept here. You create a form, and on the form you have a combobox.

    I have created a form based on one of my tables (Employee). The form has a combo(combo0) a textbox(text2) and a listbox(lstEmployees).
    The initial form is in Emp_cmbo0.jpg

    The purpose of text2, is to show you the ID for my selected Employee. Note the ID is hidden in the combo, and when I select an employee by name, startdate or whatever, the ID is "obtained from the Table for use (in your second table) and in my case I just put it in Text2.

    emp_cmbo2.jpg shows how to assign data to the combo0. This is the full query
    Code:
    SELECT Employee.EmpId, Employee.FName, Employee.LName, Employee.PayNo, Employee.StartDate
    FROM Employee
    ORDER BY Employee.LName, Employee.FName, Employee.StartDate;

    The purpose of lstEmployees, is to show you the id and names of all the employees, so you'll see the id of the employee I select is the right one.

    Once an employee is selected, I use the AfterUpdate event of the combo to place the
    "value of the bound column" (in my case the ID) in to text2.
    Here is the event code
    Private Sub Combo0_AfterUpdate()
    'Text2 will contain the Id that I'd store in another table
    'The Id to store is associated with the Employee selected in the combobox
    Me.Text2.Value = Me.Combo0.Value
    End Sub
    Emp_cmbo1.jpg shows all of the fields that I've included in the dropdown. In your case, Emp_num, Rfid, Name or whatever else you want.

  7. #7
    neil123williams is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    16
    Thank you for all the detailed info, I think I'm heading in the correct direction now, some cob webs are starting to break up with your help. Thanks again.

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

Similar Threads

  1. Replies: 4
    Last Post: 08-16-2011, 05:54 PM
  2. Replies: 4
    Last Post: 01-24-2011, 07:11 PM
  3. Replies: 5
    Last Post: 01-02-2011, 10:09 AM
  4. Replies: 1
    Last Post: 08-26-2009, 10:45 AM
  5. Replies: 0
    Last Post: 08-17-2008, 12:19 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