Results 1 to 6 of 6
  1. #1
    ipitydafool is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    3

    Option Groups and Adding Data to Tables

    So I'm working on my final project for school and I want to try something cool my project. I want to make a form that has an option group at the top. The user can either select a radio button to 'add an employee' or to 'update/delete an employee.'

    After they choose an option the form populates accordingly. If they want to 'add an employee' the form has all the column titles with text boxes for the user to fill out and a button below to add or to print the new employee.

    If they choose to 'update/delete an employee' then the column titles appear again but the text boxes fill in accordingly depending on what Employee ID is select from a drop down box.

    I've done things similar to this in C# but I don't see how to do this in Access. If this isn't possible or really isn't practical my second idea is to just have a form where you can select an Employee ID or a 'new' employee ID and the text boxes below populate (or remain blank) accordingly. Basically the user can select employee ID 4 and the first name, last name, address, etc etc fill in or they can select new and all the text boxes are blank. At the bottom of the form would be an option to save (either the update or the new employee) or to print the current form.

    Thanks for any help and reading the lengthy post!


    EDIT: If necessary the columns are:


    Employee ID (Primary Key)
    eFirstName
    eLastName
    SSN
    EmployerName (foreign key to the employers table)
    PlanID (foreign key to the insurance plan table)
    ClassTitle
    Address
    City
    State
    Zip
    Phone Number
    Email

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Well Mr. T, the option group could probably work. You'd use the after update event of the frame, test its value and take the appropriate action. Depending on what you want to do, that might be resetting the record source, using GoToRecord, using a bookmark, etc. To do it from outside you could use this to open to a given record:

    BaldyWeb wherecondition

    or use the data mode argument of OpenForm to go to a new record.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ipitydafool is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    3
    Ok, I got the form to change and show the appropriate text boxes depending on what is selected. I now am having one problem.

    How do I make it so when the user selects 'Add Employee' the text boxes are still tied to the appropriate data (employee table) but the boxes are empty and editable?

    Basically, when I select the 'Control Source' it makes it the first option (Employee 1). I see there is a 'Default Option'...option but I have no idea how to use it or set it basically to the 'New Record Option'.

    Thanks again!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It sounds like you want to use GoToRecord to go to a new record. More info on the required arguments in VBA help (I think you can also use a macro, but I don't use them).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    ipitydafool is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    3
    Yup that worked. I feel like the project might be a little more complicated then it needs to be, but I did learn a lot from doing this. It's really not so different from C#, just had to learn where to start. You have been a big help man, thanks!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problemo, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Option Groups - change value from number to text
    By nchesebro in forum Programming
    Replies: 10
    Last Post: 02-09-2011, 03:52 PM
  2. DSum in Query - Adding groups
    By Huddle in forum Queries
    Replies: 1
    Last Post: 02-04-2011, 07:53 PM
  3. Replies: 3
    Last Post: 11-03-2010, 09:53 AM
  4. Adding data to tables
    By HunterEngineeringCoop in forum Access
    Replies: 3
    Last Post: 10-19-2010, 12:01 PM
  5. Automatically Adding New Data to Tables
    By aquarius in forum Import/Export Data
    Replies: 1
    Last Post: 09-15-2010, 07:27 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