Solved

add new record from subform

Posted on 2013-06-28
5
734 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 45

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now