Results 1 to 2 of 2
  1. #1
    kelann is offline Learning ... thank you!!
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    132

    Only one primary contact (ContactsT) for each associated organization (OrganizationsT

    Hi, all!



    I have a table (OrganizationsT) and a contacts table (ContactsT).

    On ContactsT, there is a combobox (ContactOrg) that pulls from OrganizationsT, so the contact can be associated with an organization.

    On ContactsT, there is also a yes/no checkbox (PrimaryContact). Each organization can have several contacts, but there should be only one primary contact.

    What I am trying to do is this: If they check the PrimaryContact box, but another contact has that already checked for the same ContactOrg field, they should get a message box.

    If they are checking, and there already is a primary contact, it should say, "ContactFullName is already the Primary Contact for this Organization. You must edit this contact before selecting a different primary contact." It would be a bonus if, after 4 seconds or so, it popped up my contact edit form (ContactEditF).

    I figure it has an event related to OnClick, but I didn't want to happen when the OnClick UNCHECKS the box.

    Thank you so much for your thoughts -- I couldn't even begin to figure out how to google this!!!

    --ak

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    You are using a form for this data entry/edit? You could use a form/subform arrangement so that ALL contacts for Organization are displayed in subform. It would then be evident which record is checked as primary. Could have code in checkbox event (OnChange or BeforeUpdate, not sure as I don't use checkboxes much) to validate user entry. Something like:

    If Me.checkboxname = True Then
    If DCount("ID","tablename","checkboxfield=True") > 0 Then
    MsgBox "Your message"
    DoCmd.OpenForm "your form name"
    End If
    End If

    If you don't use forms then maybe data macro will handle this code but I have never used data macros.
    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.

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

Similar Threads

  1. Report Layout Organization Help
    By dylan.greene in forum Reports
    Replies: 5
    Last Post: 09-19-2012, 01:46 PM
  2. Auto Organization?
    By ProjectCamaro in forum Database Design
    Replies: 9
    Last Post: 01-18-2012, 07:00 PM
  3. Relationships/Data Organization
    By mixfeat in forum Access
    Replies: 2
    Last Post: 03-28-2011, 03:55 PM
  4. Report organization
    By kstyles in forum Reports
    Replies: 7
    Last Post: 01-10-2011, 02:47 PM
  5. Organization help needed
    By Logan in forum Database Design
    Replies: 2
    Last Post: 07-30-2010, 11:00 AM

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