Solved

add new record from subform

Posted on 2013-06-28
5
738 Views
Last Modified: 2013-07-24
Hi Guys

I m going crazy with a simple subform

Main form
IDMain
date

Subform
ID
IDLink
field 1
field 2

relationship 1 to many enforced

I am displaying both forms and link field is IDMain --> IDLink

when i add a record in the subform, it is supposed save it and when i click new record on the main form it should create the id and add that id to the linked field in the subform, but that is not happening.
all other info is created in the subform but the linked field.

what is happening i have done this many times with no issues but now its taking me too long to figure it out what is happening.

Please help

thanks
0
Comment
Question by:titorober23
  • 2
5 Comments
 
LVL 21

Accepted Solution

by:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 250 total points
ID: 39285959
The Master Linking field is automatically added from the parent form to the child linking field in the sub form when a new record is added.

Make sure that the child linking field in in the sub form's record source. I usually add a bound textbox for the child linking field and set it to hidden.  You can make it visible to see if everything is working.
0
 

Author Comment

by:titorober23
ID: 39285975
the issue was that in the master i had 2 fields id and date, id was autonumber, date default value was set to now(), but because i did not change the date it was not creating a record on the master table- so when adding a new record i have to set the date in the field by code, set the focus in that control so the user must click on it so it could create the record, sounds a little weird, but it is because in the master i only have 1 field.
0
 
LVL 21

Assisted Solution

by:Boyd (HiTechCoach) Trimmell, Microsoft Access MVP
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 250 total points
ID: 39286001
Yeah. You must insure the master record is generated before navigating to the sub form. This is an issue when the parent form's fields have a default value and the use wants to go directly to the sub form.

One solution is to have a save button on the parent form the saves/creates the record and unlocks the sub form.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39352495
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question