Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Auto enter an ID # in a sub-form

0 views
Skip to first unread message

Paul

unread,
Nov 10, 2009, 1:31:01 PM11/10/09
to
I have a form with a button that opens a sub-form when I click on the button.
The "ID#" fields are linked via relationship between the form and sub-form.
When the sub-form opens, the ID # on the sub-form defaults to O. In order to
tie the sub-form to the form, you must enter the ID # from the form to the
sub-form. If the user forgets to enter the number, or enters the wrong
number, then the entry is tied to the wrong entry of the form.
Can anyone tell me how to auto enter the number from the ID# field on the
form into the ID# field on the sub-form?
Thanks, Paul

Jeff Boyce

unread,
Nov 10, 2009, 1:56:55 PM11/10/09
to
Paul

In a standard mainform/subform construction, the subform control (on the
main form) has two properties. One points to the field/control on the main
form that has the ID. The other points to the field/control on the subform
that shares that ID.

Neither you nor your users EVER need to (re-)enter the ID on the subform --
if you use these properties, Access will insert the ID into a (new) subform
record when you first 'dirty' it.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or psuedocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Paul" <Pa...@discussions.microsoft.com> wrote in message
news:16800D23-03DF-497E...@microsoft.com...

John Vinson

unread,
Nov 10, 2009, 10:25:07 PM11/10/09
to
"Paul" wrote:

It sounds to me like this isn't actually a Subform (which is always open in
a Subform window on the mainform, and which has a master/child link field
property to do this for you); it sounds like you're instead popping up a
separate form. Is that intentional, or would a Subform be acceptable (since
it takes care of this issue for you with no code or effort at all)?

--
John W. Vinson[MVP]


KARL DEWEY

unread,
Nov 10, 2009, 10:29:00 PM11/10/09
to
You would not have this problem if the table for the form had a primary key
field and you set a one-to-many relationship the the table for the subform.
In tthat relation select the Referential Integerity and Cascade Update
options.
When a record is added in the subform the ID will automatically be added so
there is no need to display it in the subform.

--
Build a little, test a little.

rruston

unread,
Nov 12, 2009, 11:38:01 AM11/12/09
to
I had this problem, too. How I solved it is that I set the Default property
for the control for the ID# of the subform to equal the ID# of the main form.
I used the Expression Builder. Good Luck!

yamakamiいるか

unread,
Nov 27, 2009, 9:00:37 PM11/27/09
to
私は、どうして、こんなに、辛い日々を、???

トラジ(河村つよし)は、私に、レイプした人!!!!!

携帯090-8607-8611


ワンギリスタート!!!!!!!!!!!!!!!

watasiha,

zettaini,yurusanai!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


borantyia,

okaneha,

sonnnani,irimasen,

hisasiburini,

ge-senni,ikereru,kuraiha,

hosiidesuga???!!!!


それ以外は、いりません!!♪

そんな、高額をもらいたくは、ないです!!☆

そんな、お金が、あったら、盲導犬に、寄付したいと、思っています!!!

ユニセフとかは、上の人ばかりが、取って、本当に、必要な、貧しい人たちには、全くお金が、いっていないということを、知り合いから、聞きました!!!

honntouno,koto,rasii,desuyo!!!!!!!!!!!!!

watasiha,

usoo,tukuhitoga,

daikirai!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


"Paul" <Pa...@discussions.microsoft.com> wrote in message
news:16800D23-03DF-497E...@microsoft.com...

assaillit

unread,
Jan 7, 2010, 7:40:21 AM1/7/10
to
je n'ai besoin de rien et veuillez me laisser tranquille: merci assaillit

"yamakamiいるか" <‚‡‚ƒ‚˜‚†‚ 3...@yahoo.co.jp> a écrit dans le message de groupe
de discussion : eM4jR$8bKHA...@TK2MSFTNGP05.phx.gbl...

0 new messages