Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Subform: Cannot insert the value NULL...

Author  Topic 

whill96205
Starting Member

46 Posts

Posted - 2004-07-29 : 14:39:50
I have a View that was created as a JOIN between three tables in SQL. Here's the SQL that creates the View:

SELECT [ORDER-DETAIL].OrderID, [ORDER-DETAIL].EbayNum,
LOT.LotNum, LOT.Description, LOT.WarehouseLoc, AUCTION.PaidStatus
FROM dbo.AUCTION INNER JOIN
dbo.[ORDER-DETAIL] ON
dbo.AUCTION.EbayNum = dbo.[ORDER-DETAIL].EbayNum INNER JOIN
dbo.LOT ON dbo.AUCTION.LotNum = dbo.LOT.LotNum

The View is used to create a form in Access, that I then drag onto a Main order form to become a subform. Within the subform, users can enter new records which are saved to the unique table (ORDER-DETAIL). These records are entered into the subform by way of the EbayNum field. Basically, a user enters an EbayNum into the row of the subform, and a new record (EbayNum-OrderID) is supposed to be created in the ORDER-DETAIL table.

Problem: When I try to enter a new record, I get the error:
"Cannot insert the value NULL into column 'EbayNum', table 'dbo.AUCTION'; column does not allow NULLs. INSERT fails."

Okay...

1) Nowhere have I specified that any records are to be created in the AUCTION table via this subform; the unique table is ORDER-DETAIL. For that matter, the EbayNum field in the subform comes from the ORDER-DETAIL table, not the AUCTION table.
2) The value being entered into the EbayNum field in the subform is not NULL, yet the error implies that it is.

NOTE: This subform worked just fine until I went back and added the Paid column to the SELECT statement yesterday.

Anyone shed some light? (Sorry - I haven't gotten a book yet...)
Thanks,
Whill

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2004-07-29 : 16:54:28
Have you tried LEFT joins instead of INNER joins?

-----------------------------------------------------
Words of Wisdom from AjarnMark, owner of Infoneering
Go to Top of Page

whill96205
Starting Member

46 Posts

Posted - 2004-08-12 : 10:08:48
AjarnMark,

No I haven't. Which joins should become LEFT JOINS in the SQL statement above? All of them?
Go to Top of Page
   

- Advertisement -