473,382 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Creating new records with a form and multi subforms

27
I have a table with 8 child tables that are suppose to be one-to-one relationship to main table (some how it got changed to one-to-many). I am haveing trouble creating a new record in a form that contains the 8 tables as subforms. I can create a new record in the main form but when I click one of the subforms, I get a message that the Microsoft jet database engine cannot find a record in the table 'tblxxx' with key matching field(s) 'qryxxx.indexno'. I have ensured that all the tables are connected in the relationship window and that the primary key and a foreign key are identical name and formating. Oh, I have the source for the forms coming from a query if that helps. Thanks for the help.
Dec 4 '08 #1
5 1684
nico5038
3,080 Expert 2GB
My "trick" to solve this is to change the main form into an "update" form.
The button that triggers this form to show will just create a new record and filters for this record. Thus a record is present and no problems will occur when adding related records in the subform.
The back draw will be that when a user Cancels the insert you'll have to delete the record.

Getting the idea ?

Nic;o)
Dec 5 '08 #2
Randoz
27
I'm kinda seeing where you are going with this, I just have to remember how to change it to an update form.
Dec 5 '08 #3
nico5038
3,080 Expert 2GB
I normally use some code like:
Expand|Select|Wrap|Line Numbers
  1. ' Insert new rec with e.g. the name or description
  2. Currentdb.Execute("INSERT INTO tblX (FieldY VALUES ('Fieldvalue')")
  3. ' Get the assigned autonumber ID
  4. lngID = Dmax("ID","tblX")
  5. ' Open form with filter:
  6. Docmd.Openform "frmInsertUpdateWise",,,"ID=" & lngID
  7.  
Nic;o)
Dec 5 '08 #4
Randoz
27
Forgive but I'm a little confused at the first line. If my main form is frmPersEntry based on qryMainConnector based on all the tables linked and the subform is frmEducation, based on qryEducation then table tblEducation. tblIndex has field 'Index' linked to field 'EdIndexNo' in tblEducation. How would I write the line? Thanks.
Dec 8 '08 #5
nico5038
3,080 Expert 2GB
Your form frmPersEntry should be based on the "Main" table.
When placing a subform for a related table Access will propose a linkage field. Just accept that and Access will automatically synchronize the forms.

Using a query with multiple tables will in general cause a form to be "Read only" !

Nic;o)
Dec 8 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ren | last post by:
I don't have to worry about duplicate data within a record because each record is for an individual and nothing is duplicated and all the fields must be entered for each person, so my problem is...
6
by: MS | last post by:
Access 97 here. I want a simple way to "lock" certain records on a form. Some records remain "live" until all data is available which happens over time. When all the fields are complete, I want...
2
by: Steve B | last post by:
I am trying to design a Call Log Detail form that will allow users, in a multi-user environment, to select various data/records, not necessarily in sequential order, from a subform that will, when...
7
by: Susan Bricker | last post by:
Greetings. As a relative newcomer to Access, I am having trouble deciding on how to design the form flow for updating and creating related records. I'm looking for a variety of suggestions so...
3
by: CAD Fiend | last post by:
Hello, I have a land development project that has a many-to-many relationship. I have ONE question regarding table structures, and ONE question on how to make a Form with two Subforms, below. ...
7
by: philelpko | last post by:
Good Morning all, I have a main form with 3 subforms. All of the input data on all the forms is stored in the same table. I started getting the message "the changes you requested to the table...
5
by: Don Do | last post by:
Ok, this is my 2nd ever post. 1st one was solved quickly. Thanks. Now I'm stuck again. My mdb has a main form with 3 subforms. Each tied to the succeeding by single autonumberID/foreign...
12
by: binky | last post by:
Quick question that I can't find a solution to: I have an ADP application that uses SQL Server 2000 backend, along with stored procedures that populate my forms. I do not want to use subforms for...
1
by: mgoodman | last post by:
I have a main form w/ two subforms in Access. Based on their parent/child fields, the subforms call up existing matching records. My problem is: when there is no matching record in my subform it...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.