Form/subForm nuance

M

Marie-Lynn

Hello again,

I have FormA and FormB. FormA is my main form and FormB contains
information that I want to ALWAYS related to an entry in FormA. As a result,
FormA is my main form and FormB is my subform.

(FormA is a contact directory and FormB is a voicemail log. Where there is
an entry in the voicemail log, there is ALWAYS a related entry in the contact
directory, but there is not always neccessarily a voicemail log for every
contact directory entry).

I have made FormA and B work with each other fairly well. My problem is
this: If I make a new entry in FormB (subform), it will not automatically
connect to a new entry in FormA (form). The form / subform relationship is
FormA's line form_b_autoentry which is connected to FormB's autonumber line
(also - probably irrelevent - FormB's primary key.

How do I make FormA's line 'form_b_autoentry' automatically populate/update
- when FormB's autonumber line updates - with the new, corresponding number
in FormB's aunumber line? (FormB's autonumber = FormA 'form_b_autoentry') Is
there a short macro or something I need to write?

Thank in advanced,
ML
 
K

KARL DEWEY

The form / subform relationship is FormA's line form_b_autoentry which is
connected to FormB's autonumber line (also - probably irrelevent - FormB's
primary key.
You can not use FormB's autonumber in a many side of a relation as an
autonumber generates unique numbers and therefore you can not have but one of
each.
Use an autonumber in the table for FormA and a Number - long integer in
FormB table. Set FormA table autonumber as primary key. Click on menu TOOLS
- Relationships and add the two tables to the relationship window. Click on
the FormA table autonumber field (it will be bold due to being primary key)
and drag to the FormB table number - long integer field. Select Enforce
Regerential Integerity and Cascade Update Related Fields.

Open you FormA in design view, click on the very upper left corner to the
subform. Click on VIEW - Properties. Scroll down to the Master & Child link
and set both to the fields names autonumber & long integer of the two tables.
 
M

Marie-Lynn

Thank you. Works flawlessly.

One question, though: Why can't I use the primary key of the subform to a
long interger field in the main form (the exact reverse of what you suggest).

Thanks again,
ML
 
K

KARL DEWEY

The idea of form/subform is one-to-many. The primary key is always the one
side.
 

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

Similar Threads

shortcut menu 1
Duplicate A Form Object - Please Help 3
Accessing controls on a subform 3
Inter-related form 7
Requery a combo box 2
Independent Transfer!!! 2
AcNext on subform doesn't work! 1
Forms question 2

Top