Can I lose new record on sub form?

R

Robin Chapple

I have a sub form on a member from which shows the member history. It
is set to multiple forms in order to show many entries per member.

It always provides a new record which I would prefer to lose.

Is this possible?

Thanks,

Robin Chapple
 
K

Ken Snell [MVP]

You wish to not show the "empty" and ready "new record" in the subform? Set
the AllowAdditions property of the form that is serving as the subform to
No.
 
R

Robin Chapple

I have the tab working as planned but as it leaves the field it
deletes the data.

How do I fix that.

Robin Chapple
 
K

Ken Snell [MVP]

Tab? in the subform? main form? what code is running on any of the control's
events where the data are disappearing? Is the form's AllowEdits property
set to Yes? By "deletes data", does it just not store the data you entered,
or is actually deleting the data after it stores the data?
 
R

Robin Chapple

Tab? in the subform? main form?

I am tabbing from the sub form back to the main form.
what code is running on any of the control's
events where the data are disappearing?

The sub form is a single field. Here is the code:

Private Sub DateJoinedThisClub_LostFocus()

Me.Parent![Notes].SetFocus

If IsNull(Me.Parent![DateJoinedLeague]) Then
Me.Parent![DateJoinedLeague] = [DateJoinedThisClub]
End If

End Sub
Is the form's AllowEdits property set to Yes?
Yes

By "deletes data", does it just not store the data you entered,
or is actually deleting the data after it stores the data?

I cannot determine the answer to your question but, at first, the new
date is visible in the "DateJoinedThisClub" field and appears in the
"DateJoinedLeague" field.

Then I tab and the original data disappears. The data in the
"DateJoinedLeague" remains.

Thanks,

Robin Chapple
 
K

Ken Snell [MVP]

Does tabbing back to your main form cause any code to run that requeries
your subform? That could cause the data to "disappear" from view because the
record no longer is related to the main form?

Is [DateJoinedThisClub] in the subform bound to a field in the subform's
recordsource? Or is it an unbound control? If it's bound, are the data still
in the table's field where they should have been stored by the subform?
--

Ken Snell
<MS ACCESS MVP>



Robin Chapple said:
Tab? in the subform? main form?

I am tabbing from the sub form back to the main form.
what code is running on any of the control's
events where the data are disappearing?

The sub form is a single field. Here is the code:

Private Sub DateJoinedThisClub_LostFocus()

Me.Parent![Notes].SetFocus

If IsNull(Me.Parent![DateJoinedLeague]) Then
Me.Parent![DateJoinedLeague] = [DateJoinedThisClub]
End If

End Sub
Is the form's AllowEdits property set to Yes?
Yes

By "deletes data", does it just not store the data you entered,
or is actually deleting the data after it stores the data?

I cannot determine the answer to your question but, at first, the new
date is visible in the "DateJoinedThisClub" field and appears in the
"DateJoinedLeague" field.

Then I tab and the original data disappears. The data in the
"DateJoinedLeague" remains.

Thanks,

Robin Chapple
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top