I have a table 'product' the parent, and 'ingredient' as childtable.
I use a master/detail solution (created by the vb application wizzard).
textboxes, a combobox (for navigating through the recordset, rstMix), and a
datagrid.
Everything works just fine as long as i stay away from adding
(rstMix.addnew) mnew records (parent and child) .
The error comes when I try to save...
The errormessages (following: rstMix.UpdateBatch adAffectAll) are:
"You cannot add or change a record because a related record is required in
table 'product'."
and then
"Index or primary key cannot contain a Null value."
Below is the code i use for data-retrieval.
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=MSDataShape;Data PROVIDER=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\...
Set rstMix = New Recordset
rstMix .StayInSync = True
rstMix .Open "SHAPE {SELECT * FROM Products Order by UProdukt}
AS ParentCMD
APPEND ({SELECT * FROM ingredientOrder by
LProdukt }
AS ChildCMD
RELATE UProdukt TO UProdukt)"
, db, adOpenDynamic, adLockOptimistic
Please help befor i go crazy,
Susanne