Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006
    Posts
    20

    Unhappy Unanswered: Use checkbox to establish relationship (was "Please help...")

    I've posted this previously in the other forum and I was hoping someone would be able to help me here...

    I was wondering if anyone could help me with a problem I'm having with a form...

    I have 2 tables, one called 'dept' and the other called 'employees.' These tables have a one-to-many relationship; basically, one department to many employees.

    I have this form (from the employee table) and I'm trying to avoid using a combo box to do this. I would like to assign an employee (employees_table) to a department (dept_table) by simply selecting a checkbox on a tabular (employee) form.

    Is there anyway I can make a checkbox (once checked) assign that particular record to another record, being that it's a one-to-many relationship?

    I would greatly appreciate any help. Thank you!!!

  2. #2
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    I suppose you could make the dept table the record source for a main form, and the employee table could be the record source for a child form.

    But I'm confused, why would you deliberately avoid using the combo box, when it's the control of choice for this task......

    Sam

  3. #3
    Join Date
    Mar 2004
    Location
    UK
    Posts
    82

    Combo the way to go

    I agree, a combo would seem the right choice for what you're trying to do.

    If you have to use a check box or option button then i guess you'll need a check box for each record in the [dept] table.

    this seems a very long winded way of achieveing something very simple, but you can use the onupdate event on each option button to change the field relating to the dept

    if me.option22 = true then docmd.gotocontrol "field_in_emplyee_form"
    [field_in_emplyee_form].value = "required value"
    end if
    but remember, you'll have to set the other option buttons to false too.

    if me.option22 = true then docmd.gotocontrol "field_in_emplyee_form"
    [field_in_emplyee_form].value = "required value"
    me.option24 = false
    me.option26 = false
    me.option28 = false
    end if

    and you'll have to repeat this with the required values for each option or checkbox.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •