[AccessD] Leave Subform

jwcolby jwcolby at colbyconsulting.com
Thu Sep 20 15:27:18 CDT 2007


Mark,

>I just want to change a field in the subform to a certain value when the
user exits the subform.

That is not plain English, that is database speak.

I am trying to discover what you are doing so that I can suggest a different
way of doing it.  What is the field?  Why does it need to be set when the
user leaves the subform?  What kind of value will go in the field?  Is this
a "trail" of what the user was looking at last?

A subform tries to save a record being edited when you leave the subform.
You are intentionally editing the subform record when you leave the subform.
The subform tries to save the record that you just edited.  A vicious
circle...

I would suggest that you will need to store the PK of the subform "current"
record, then from up in the main form run code to update that record, some
specific field.  NOT EDIT A FIELD ON THE SUBFORM, but rather run SQL that
edits the record back in that table.  You should be able to do that from the
OnExit of the subform control because SQL is editing data in a table, not
modifying a control on a subform.

John W. Colby
Colby Consulting
www.ColbyConsulting.com 
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte
Sent: Thursday, September 20, 2007 3:59 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Leave Subform

John,

I'm ok with the events in the subform firing...

Plain English...I just want to change a field in the subform to a certain
value when the user exits the subform.  I don't want this to happen when
they just move to another record in the same subform.

Thanks,

Mark


>From: "jwcolby" <jwcolby at colbyconsulting.com>
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: "'Access Developers discussion and problem 
>solving'"<accessd at databaseadvisors.com>
>Subject: Re: [AccessD] Leave Subform
>Date: Thu, 20 Sep 2007 15:42:30 -0400
>
>Mark,
>
>AFAIK this won't work.  The problem is that when you change a record on 
>the sub form events in the subform will fire.
>
>What are you really trying to do, in plain English?
>
>
>John W. Colby
>Colby Consulting
>www.ColbyConsulting.com
>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com
>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte
>Sent: Thursday, September 20, 2007 3:21 PM
>To: accessd at databaseadvisors.com
>Subject: [AccessD] Leave Subform
>
>Hello All,
>
>Have an A97 db...I have a subform/continuous...when I leave/exit that 
>subform I want to change a value on the current record of the subform.  
>I thought I could do this by using the "On Exit" property of the subform.
>The
>problem is when I click out of the subform...the "on Exit" does 
>fire...but if I put code in that references the field I want to 
>change...the click part is cancelled and the subform maintains focus.
>
>Any suggestions?
>
>Thanks,
>
>Mark
>
>P.S...I can't use the "Before Update" of the subform itself...because 
>going to a new record in the form does something different.
>
>_________________________________________________________________
>Kick back and relax with hot games and cool activities at the Messenger 
>Cafi. http://www.cafemessenger.com?ocid=TXT_TAGHM_SeptHMtagline1
>
>
>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com

_________________________________________________________________
Gear up for Halo. 3 with free downloads and an exclusive offer. 
http://gethalo3gear.com?ocid=SeptemberWLHalo3_MSNHMTxt_1





More information about the AccessD mailing list