Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3394490
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:10:35+00:00 2026-05-18T04:10:35+00:00

Short Version Is there a way to force (or provide a hint to) Microsoft

  • 0

Short Version

Is there a way to force (or provide a hint to) Microsoft Access to perform an insert (through an updateable query) in a certain order (between tables), or to tell it that one column in a query depends on (the auto-generated value of) another column in that query?

Longer Version

When I insert values into an updateable query which spans 2 joined tables (both of which are linked tables on an MS SQL Server) through a form, I get the following error:

ODBC–call failed.

[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column <fk column>’, table ‘<tablename>’; column does not allow nulls. INSERT fails (#515) [Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated. (#3612)

This is because Access does not recognize that the fk column of the second table should have the same value as the pk column of the first table in the query (or doesn’t successfully execute the query so this happens).

This behavior is observed on Access 2000, 2003, 2007 connecting to MS SQL Server 2005 (Express or Workgroup) through the Microsoft SQL Server ODBC connector.

Play Along At Home

For those of you who would like to play this game at home, here’s how to reproduce the behavior I am describing. First, create the test tables in SQL Server:

CREATE TABLE People
(
    PersonID INT IDENTITY NOT NULL
        CONSTRAINT PK_People PRIMARY KEY,
    FullName NVARCHAR(100) NOT NULL
);
CREATE TABLE Gamers
(
    PersonID INT NOT NULL
        CONSTRAINT PK_Gamers PRIMARY KEY
        CONSTRAINT FK_Gamers_People REFERENCES People (PersonID)
            ON DELETE CASCADE
            ON UPDATE CASCADE,
    Alias NVARCHAR(100) NOT NULL
);

Then, create a new blank Access database and create new linked tables which reference the tables created above. Create a relationship between the tables in the Relationships editor (Access will correctly determine that it is a one-to-one relationship). Then create the following query:

SELECT People.PersonID AS People_PersonID, People.FullName,
    Gamers.PersonID AS Gamers_PersonID, Gamers.Alias
FROM People
    INNER JOIN Gamers ON People.PersonID = Gamers.PersonID;

Note that the above query does work properly for inserting through the Dataset view (as long as FullName is entered, of course).

Then, create a form with the RecordSource set to the query above. Create text boxes for FullName and Alias. Then switch to Form View and try to insert data. With any luck, you will see the error message quoted above.

Possible Workarounds

One way to work-around this problem is to create a sub-form for the data in the child table. With suitable border and coloring it is almost transparent to the user. However, this has a few problems. First, extra code must be added to prevent entering the subform before the parent form is completed (otherwise Access will provide dense errors to the user about master/child link fields). Also, users can’t sort/filter on any field in the subform, since it would only filter subform records (of which there will always be exactly one). That being said, it is the solution that I am using for now.

I’m hoping one of you know of a better solution. Thanks for reading.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T04:10:36+00:00Added an answer on May 18, 2026 at 4:10 am

    You could use:

    Private Sub FullName_AfterUpdate()
    If Me.Dirty Then Me.Dirty = False
    
    End Sub
    

    This will force the creation of the People record.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Topic says it. Short version: I need a way to force a refresh of
I am writing an application to manage user access to files. The short version
Short of cutting and pasting, is there a way to sort the methods in
Short of copying the entire .netbeans directory is there any way to transfer custom
Short version: Is it easy/feasible/possible to program modal window in Flash (AS3)? Is there
Short version: I want a way to run somefunction(username) and have it return the
Short version: I want to trigger the Form_Load() event without making the form visible.
Short version: I'm wondering if it's possible, and how best, to utilise CPU specific
Short version: assuming I don't want to keep the data for long, how do
Short Version: When I've created a Channel using ChannelFactory on a client which uses

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.