Subforms (1 Viewer)

MaleNurse325

Registered User.
Local time
Today, 05:56
Joined
Jan 11, 2016
Messages
67
I have a form [frmRegister] with a subform [sfrmPriority]
They are Master and Child.

frmRegister is master [MaterID] and the child is sfrmPriority [PriorID] both of these are auto generated numbers. They do have an established relationship between the source tables.
The problem arises when I try to add a record. I have one record that works beautifully but when I try to add a further record the subform is blank. Is this because until I have entered data into the subform there is no PriorID number generated? How do I get around this. :banghead::banghead::banghead::banghead:
Thanks in anticipation I know you will come through for me.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 13:56
Joined
Feb 19, 2013
Messages
16,610
you need to provide more information

1.what are the subform form data property settings for data entry and allow additions. 2.And what are the linkchild and linkmaster settings for the subform control
3.can you provide a screenshot of the relationships between these two tables
 

Ranman256

Well-known member
Local time
Today, 08:56
Joined
Apr 9, 2015
Messages
4,337
You cannot add a subrecord UNTIL the master record is saved.
the form allows you to enter master record and subrecord , even tho master rec is still in edit mode. This ruins the subrec index.

Either disable the subform until the master rec is saved,
or be sure to save it THEN enter sub recs.

also did you link the subform to the master rec using subform properites:
LINK MASTER FIELD
LINK CHILD FIELD
 

MaleNurse325

Registered User.
Local time
Today, 05:56
Joined
Jan 11, 2016
Messages
67
Two screen shots of the properties

frmRegister is master [MaterID] and the child is sfrmPriority [PriorID] both of these are auto generated numbers. They do have an established relationship between the source tables.
The problem arises when I try to add a record. I have one record that works beautifully but when I try to add a further record the subform is blank. Is this because until I have entered data into the subform there is no PriorID number generated? How do I get around this. :banghead::banghead::banghead::banghead:
Thanks in anticipation I know you will come through for me
 

Attachments

  • Capture22.JPG
    Capture22.JPG
    86.9 KB · Views: 35
  • Capture33.JPG
    Capture33.JPG
    70.7 KB · Views: 32

MaleNurse325

Registered User.
Local time
Today, 05:56
Joined
Jan 11, 2016
Messages
67
This is the appearance of the form that works perfectly and when I get when I try to add a record.
 

Attachments

  • Capture44.jpg
    Capture44.jpg
    94.1 KB · Views: 36
  • Capture55.JPG
    Capture55.JPG
    76.9 KB · Views: 32

MaleNurse325

Registered User.
Local time
Today, 05:56
Joined
Jan 11, 2016
Messages
67
The relationships so far
 

Attachments

  • Capture66.JPG
    Capture66.JPG
    64.1 KB · Views: 36

CJ_London

Super Moderator
Staff member
Local time
Today, 13:56
Joined
Feb 19, 2013
Messages
16,610
As I suspected - you are matching a primary key to a primary key - so there can only ever be one record. Further, because these are autonumbers they will very quickly get out of sync.

From the description of your form structure, tblMaterials is your parent table and tblPriority the child. Therefore your tblPriority needs another field (numeric, long) called say MaterialID. Your relationship is then between MaterID and MaterialID.

Make that change and then in your subform bring through the new field in the recordsource (note it does not need to be displayed on the form) then change the subform control linkChild to MaterialID

Note having spaces and using non alpha numeric characters in field (and table) names is not a good idea - it will cause you grief further down the line. Use the field caption property to include spaces if you have to
 
Last edited:

Users who are viewing this thread

Top Bottom