>I have a Main form with Individual information (First Name, Last Name,
>Contact Info, etc) and a subform with Specialty Information (Surgeon,
[quoted text clipped - 3 lines]
>info without being forced to enter specialty information (any time a phone
>number is provided within the Individual's information).
The problem here is how Subforms work. A Subform is normally used to enter
data into the "many" side of a one to many relationship; the main form is the
"one" side. For referential integrity to be enforced, Access must save the
main form record *BEFORE* anything can be entered into the subform; so the
subform mechanism saves the main form's record the moment you set focus to the
subform.
It's a "chicken or egg" problem - you say you want to save the Individual
information only *after* the specialty information is filled out; but to
prevent "orphan" records - specialists assigned to nobody in particular! - you
must save the Individual information *before*.
About the only way to really enforce this is to use unbound Forms, or
temporary tables; copy the data using VBA code to the "real" table after the
information has been entered into both tables. It's doable but can be a real
hassle.
Might just user training be a solution...?
John W. Vinson [MVP]
Nathan-bfhd - 03 May 2007 00:59 GMT
What you are saying makes sense and was kind of what I was thinking based on
the problems I've run into. The truth is, I don't really care if the
information on the Main form is saved, I just don't want the user to go on to
another record if a phone number has been entered before entering something
into the Specialty control on the subform. So, is there a way to allow the
main form to be saved, but not allow it to change records if a phone number
has been provided and the subform field is empty?
> >I have a Main form with Individual information (First Name, Last Name,
> >Contact Info, etc) and a subform with Specialty Information (Surgeon,
[quoted text clipped - 24 lines]
>
> John W. Vinson [MVP]
Nathan-bfhd - 03 May 2007 17:26 GMT
Is there a way to run code when the New Record, Next Record, or Previous
Record buttons are clicked? I know a common event to use for these buttons
is the Current event, but in this case, I think it would probably be too late
to run code in the Current event.
> >I have a Main form with Individual information (First Name, Last Name,
> >Contact Info, etc) and a subform with Specialty Information (Surgeon,
[quoted text clipped - 24 lines]
>
> John W. Vinson [MVP]