Never mind. I see your mistake. It's actually my fault. Remove the + 1 on the new ID and you should be fine.
Main Topics
Browse All TopicsI am receving this error.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] You cannot add or change a record because a related record is required in table 'Recipes'.
The error occurred in line 32
30 : , <cfqueryparam cfsqltype="cf_sql_varchar"
31 : , <cfqueryparam cfsqltype="cf_sql_integer"
32 : , <cfqueryparam cfsqltype="cf_sql_longvarc
33 : )
34 : </cfquery>
The recipesID is the PK in Recipes table and a FK in the RecipeContents table. I'm not sure where I went wrong hefre but would apreciate the help.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Not sure if this will work, but the first thing I would try is to roll the whole thing up in your <cftransaction> block so that it will all be run as a single entry. At a guess, it is erroring on the fact that when it tries to insert the second record (despite the fact that you ARE putting in the related record first) that it doesn't see the related record as existing. I'm not totally sure how this works in Access, since I just use SQL and usually write stored procs for this sort of action. CF is great, but if it's pure SQL it's usually faster just to do it in SQL exclusively. I haven't worked in Access in ages, but there is probably something equivalent to a stored proc in access... they used to be scripts, dunno now though - hopefully someone with more Access knowledge can chime in on that front.
I followed the advice of Maureengould and removed the +1, this seems to be moving me forward I am
now getting the following error.
Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] The INSERT INTO statement contains the following unknown field name: 'RecipeID'. Make sure you have typed the name correctly, and try the operation again.
The error occurred in C:\ColdFusion8\wwwroot\bus
39 : VALUES
40 : (
41 : <cfqueryparam value="#newRecipeID#">
42 : )
43 : </cfquery>
Business Accounts
Answer for Membership
by: MaureenGouldPosted on 2008-12-29 at 22:13:00ID: 23260871
What that means is that the initial record is not being seen by the code. Are you using the update method to be sure the record is saved?