By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,640 Members | 2,077 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,640 IT Pros & Developers. It's quick & easy.

Main form saving when click on subform??? A97

P: n/a
MLH
I have a form, frmVehicleEntryForm.
On it is a subform control named frmAddnlOwnrListSubForm.
The subform control's source object is frmAddnlOwnrListSubForm.

When I click on the subform control, an attempt to SAVE the partially
entered record on the main form is attempted. I do not understand
where this behavior is coming from or why. Haven't a clue where to
look. Anyone familiar with this behaviour?

Here's my subform control's Enter event procedure:
Private Sub frmAddnlOwnrListSubForm_Enter()
Me!frmAddnlOwnrListSubForm.Width = 5.2604 * 1440
Me.Repaint
End Sub

Here's a snippet from my main form's B4Update event code...
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_Form_BeforeUpdate
Dim ThisForm As String
ThisForm = Me.Name
If SaveButtonClicked = False Then
DoCmd.CancelEvent
MyString = "A SAVE action was initiated without a HARD CLICK
of the SAVE button. That "
MyString = MyString & "is not permissable on this form. SAVE
action has been aborted."
MsgBox MyString, vbExclamation, "HARD CLICK Required - " &
MyApp$ & ", rev. " & MY_VERSION$
Exit Sub
End If

So this is how I'm finding out that a SAVE is being attempted. If I
don't have code that is doing it - why is Access attempting to do it?

The ONLY code on the subform is...
Option Compare Database
Option Explicit

Sub Form_Close()
DoCmd.SetWarnings True
End Sub

May 31 '07 #1
Share this Question
Share on Google+
13 Replies


P: n/a
MLH wrote:
I have a form, frmVehicleEntryForm.
On it is a subform control named frmAddnlOwnrListSubForm.
The subform control's source object is frmAddnlOwnrListSubForm.

When I click on the subform control, an attempt to SAVE the partially
entered record on the main form is attempted. I do not understand
where this behavior is coming from or why. Haven't a clue where to
look. Anyone familiar with this behaviour?

Here's my subform control's Enter event procedure:
Private Sub frmAddnlOwnrListSubForm_Enter()
Me!frmAddnlOwnrListSubForm.Width = 5.2604 * 1440
Me.Repaint
End Sub

Here's a snippet from my main form's B4Update event code...
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_Form_BeforeUpdate
Dim ThisForm As String
ThisForm = Me.Name
If SaveButtonClicked = False Then
DoCmd.CancelEvent
MyString = "A SAVE action was initiated without a HARD CLICK
of the SAVE button. That "
MyString = MyString & "is not permissable on this form. SAVE
action has been aborted."
MsgBox MyString, vbExclamation, "HARD CLICK Required - " &
MyApp$ & ", rev. " & MY_VERSION$
Exit Sub
End If

So this is how I'm finding out that a SAVE is being attempted. If I
don't have code that is doing it - why is Access attempting to do it?

The ONLY code on the subform is...
Option Compare Database
Option Explicit

Sub Form_Close()
DoCmd.SetWarnings True
End Sub
It'd normal, it's expected, and you can't change it.

Child records are normally only allowed (by the relationship setting) when
related to an existing parent record. You can't have an existing parent record
unless you save the parent upon moving to the subform.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
May 31 '07 #2

P: n/a
MLH
>It'd normal, it's expected, and you can't change it.

Child records are normally only allowed (by the relationship setting) when
related to an existing parent record. You can't have an existing parent record
unless you save the parent upon moving to the subform.
Link Child Field and Link Master Field properties for the control
are Null. The subform functions as a glorified listbox control. The
form has worked for about a year w/ no problem. I just did something
in the past 60-90 days that caused this behaviour. It NEVER used to
save the incomplete record on the Main Form before now.
May 31 '07 #3

P: n/a
MLH wrote:
It'd normal, it's expected, and you can't change it.

Child records are normally only allowed (by the relationship
setting) when related to an existing parent record. You can't have
an existing parent record unless you save the parent upon moving to
the subform.

Link Child Field and Link Master Field properties for the control
are Null. The subform functions as a glorified listbox control. The
form has worked for about a year w/ no problem. I just did something
in the past 60-90 days that caused this behaviour. It NEVER used to
save the incomplete record on the Main Form before now.
As far as I know moving focus to the subform is equivelant to moving to a
different record. The record in the main form is saved. The MasterLink and
ChildLink properties have nothing to do with it. Doesn't even matter if the
subform is unbound.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
May 31 '07 #4

P: n/a
MLH
>As far as I know moving focus to the subform is equivelant to moving to a
>different record. The record in the main form is saved. The MasterLink and
ChildLink properties have nothing to do with it. Doesn't even matter if the
subform is unbound.
You know, you're probably right. Now that I think about it, I could
never select the subform control in my earlier versions of this app
after I'd entered ANYTHING at all onto the main form. I always had
to make my entries on the subform control FIRST, then start making
the entries onto the main form. Once the main form's fields had been
properly filled out, I explicitly saved the record.

Gonna have to rethink this form.
May 31 '07 #5

P: n/a
On Wed, 30 May 2007 22:47:34 -0500, "Rick Brandt"
<ri*********@hotmail.comwrote:

That is correct. You can show the RecordSelector and see the pencil
turn into a triangle when you step into the subform.

-Tom.

>MLH wrote:
It'd normal, it's expected, and you can't change it.

Child records are normally only allowed (by the relationship
setting) when related to an existing parent record. You can't have
an existing parent record unless you save the parent upon moving to
the subform.

Link Child Field and Link Master Field properties for the control
are Null. The subform functions as a glorified listbox control. The
form has worked for about a year w/ no problem. I just did something
in the past 60-90 days that caused this behaviour. It NEVER used to
save the incomplete record on the Main Form before now.

As far as I know moving focus to the subform is equivelant to moving to a
different record. The record in the main form is saved. The MasterLink and
ChildLink properties have nothing to do with it. Doesn't even matter if the
subform is unbound.
May 31 '07 #6

P: n/a
MLH
You guys are right. I've had the subform control on the form for a
long time. Because of my habit of first making my settings on the
subform control itself, then returning to the main form, I wasn't
noticing the action the way I am now.

What I was trying to do with the subform on the mainform was display
a list of records in tblAddnlOwners in a control that would let me
browse the records and click a checkbox in each record I wanted to
mark - setting the value of a Yes/No field in that table in one or
more records.

That's easy enough to do on an entirely separate form. Just pop the
form open, place checkmarks on the desired records and close the
form when done. I was trying to include such functionality on the main
form itself.I guess I thought a subform control would be like opening
another form - just imbedding it for display purposes on the main
form. Turns out nothing could be further from the truth.

Unless one of you guys know how I can do this, I'll just do away with
the subform control altogether and open the form that was the source
object of the subform control. That way, switching back 'n forth
between the 2 forms won't force a SAVE on the main form's incomplete
record.
May 31 '07 #7

P: n/a
Tom van Stiphout <no*************@cox.netwrote in
news:ul********************************@4ax.com:
You can show the RecordSelector and see the pencil
turn into a triangle when you step into the subform.
Well, that's kind of stupid, don't you think?

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
May 31 '07 #8

P: n/a
On Thu, 31 May 2007 15:14:51 -0500, "David W. Fenton"
<XX*******@dfenton.com.invalidwrote:

I was just trying to show him another way to verify that indeed the
parent record is saved when you step into the subform.
-Tom.

>Tom van Stiphout <no*************@cox.netwrote in
news:ul********************************@4ax.com :
>You can show the RecordSelector and see the pencil
turn into a triangle when you step into the subform.

Well, that's kind of stupid, don't you think?
Jun 1 '07 #9

P: n/a
rkc
David W. Fenton wrote:
Tom van Stiphout <no*************@cox.netwrote in
news:ul********************************@4ax.com:
>You can show the RecordSelector and see the pencil
turn into a triangle when you step into the subform.

Well, that's kind of stupid, don't you think?
I must be stupid because I do not understand this comment.
Jun 1 '07 #10

P: n/a
Tom van Stiphout <no*************@cox.netwrote in
news:4p********************************@4ax.com:
On Thu, 31 May 2007 15:14:51 -0500, "David W. Fenton"
<XX*******@dfenton.com.invalidwrote:
>>Tom van Stiphout <no*************@cox.netwrote in
news:ul********************************@4ax.co m:
>>You can show the RecordSelector and see the pencil
turn into a triangle when you step into the subform.

Well, that's kind of stupid, don't you think?

I was just trying to show him another way to verify that indeed
the parent record is saved when you step into the subform.
That wasn't directed at your suggestion -- it's that I think the
Access behavior is dumb. Sorry if that was confusing.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jun 1 '07 #11

P: n/a
rkc <rk*@rkcny.yabba.dabba.do.comwrote in
news:46**********************@roadrunner.com:
David W. Fenton wrote:
>Tom van Stiphout <no*************@cox.netwrote in
news:ul********************************@4ax.com :
>>You can show the RecordSelector and see the pencil
turn into a triangle when you step into the subform.

Well, that's kind of stupid, don't you think?

I must be stupid because I do not understand this comment.
What I mean is that it's stupid that Access behaves that way.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jun 1 '07 #12

P: n/a
David W. Fenton wrote:
rkc <rk*@rkcny.yabba.dabba.do.comwrote in
news:46**********************@roadrunner.com:
>David W. Fenton wrote:
>>Tom van Stiphout <no*************@cox.netwrote in
news:ul********************************@4ax.co m:

You can show the RecordSelector and see the pencil
turn into a triangle when you step into the subform.

Well, that's kind of stupid, don't you think?

I must be stupid because I do not understand this comment.

What I mean is that it's stupid that Access behaves that way.
It has to behave that way when the dirty main record is a new one or when
the linking fields are changed so I guess they just made it behave that way
all the time. Seems like they could at least not do it when the MasterLink
and ChildLink properties are not filled in (as would be the case with an
unbound subform).

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jun 1 '07 #13

P: n/a
"Rick Brandt" <ri*********@hotmail.comwrote in
news:8a*****************@newssvr27.news.prodigy.ne t:
David W. Fenton wrote:
>rkc <rk*@rkcny.yabba.dabba.do.comwrote in
news:46**********************@roadrunner.com:
>>David W. Fenton wrote:
Tom van Stiphout <no*************@cox.netwrote in
news:ul********************************@4ax.com :

You can show the RecordSelector and see the pencil
turn into a triangle when you step into the subform.

Well, that's kind of stupid, don't you think?

I must be stupid because I do not understand this comment.

What I mean is that it's stupid that Access behaves that way.

It has to behave that way when the dirty main record is a new one
or when the linking fields are changed so I guess they just made
it behave that way all the time. Seems like they could at least
not do it when the MasterLink and ChildLink properties are not
filled in (as would be the case with an unbound subform).
That's my point here, and I assumed that's what you were talking
about. Obviously it *has* to be that way when there's a link field,
but you might have a non-data bearing subform, and moving to it
would save the parent record for no good reason whatsoever.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jun 2 '07 #14

This discussion thread is closed

Replies have been disabled for this discussion.