Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2003
    Location
    Bogota
    Posts
    67

    Unhappy Unanswered: form / subform validation logic spiral

    Sort of an abstract question...

    What are some common ways of dealing with validations on a form and subform when the two are interdependent?

    For instance, in a parent/child set-up, in this case accounts/contacts...

    Form: 'accounts' (requires at least one associated contact for the 'account' record to be valid)

    Subform: 'contacts' (needs an existing 'actions' id in order to be created!)

    It's sort of a catch-22, and Access' automatic saving features are driving me a bit crazy. (i.e. when you move off the main form to the subform the record is saved automatically)

    Are these issues familiar to anyone?

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    I'm guessing this is happening when you're adding a new record, so...

    In the parent form's AccountID field's AfterUpdate property, insert some code like this:

    If Me.NewRecord then
    Docmd.Runsql "Insert into tblContact (AccountID) values ('" & txtAccountID & "'")"
    Me.forms![subFormName].Requery
    end if
    Inspiration Through Fermentation

Posting Permissions

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