Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

add new record from subform

Posted on 2013-06-28
5
Medium Priority
?
755 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
4 Comments
 
LVL 21

Accepted Solution

by:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 1000 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 1000 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 49

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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Screencast - Getting to Know the Pipeline

824 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