F
Furquhart
Microsoft Server 2008
DuckRace database
Main table is Contestant with PK ContestantID
Child table is Purchases with PK PurchaseID and FK is ContestantID
I have an append query that runs from a command button and adds new purchases
to the Child table.
The following code picks up the number of ducks to be purchased from the main
form and pulls it into the IntDucks variable.
The Append Query then loops until the correct number of new records (ducks)
have been added to the child table.
If the parent record is a new record the Append query fails with the
following Error message
Microsoft Office Access can't append all the records in the append query....
MSOffice Access set 0 fields to Null due to a type conversion failur, and it
didn't add 1 record to the table due to key violations, 0 records due to loc
violations and 0 records due to validation rule violations. The primary key
for both tables is integar with no duplicates set so it is a true primary key.
I can't find anything wrong. But, if I add more ducks to an existing record
in the (Child) Purchase table it all works perfect.
Private Sub Cmd_PurchaseNewDucks_Click()
Dim IntDucks As Integer
Dim stDocName As String
IntDucks = Forms!Frm_Contestants!Ducks
stDocName = "Qry_PurchaseDucks"
counter = 0
myNum = 0
DoCmd.SetWarnings False
Do
myNum = myNum + 1
counter = counter + 1
DoCmd.OpenQuery stDocName
Loop Until myNum = IntDucks
DoCmd.SetWarnings True
DoCmd.Requery
RunCommand acCmdRecordsGoToLast
End Sub
Any suggestions?
Fred
furquhart AT hospiceanswers dot Not-For_Profit
DuckRace database
Main table is Contestant with PK ContestantID
Child table is Purchases with PK PurchaseID and FK is ContestantID
I have an append query that runs from a command button and adds new purchases
to the Child table.
The following code picks up the number of ducks to be purchased from the main
form and pulls it into the IntDucks variable.
The Append Query then loops until the correct number of new records (ducks)
have been added to the child table.
If the parent record is a new record the Append query fails with the
following Error message
Microsoft Office Access can't append all the records in the append query....
MSOffice Access set 0 fields to Null due to a type conversion failur, and it
didn't add 1 record to the table due to key violations, 0 records due to loc
violations and 0 records due to validation rule violations. The primary key
for both tables is integar with no duplicates set so it is a true primary key.
I can't find anything wrong. But, if I add more ducks to an existing record
in the (Child) Purchase table it all works perfect.
Private Sub Cmd_PurchaseNewDucks_Click()
Dim IntDucks As Integer
Dim stDocName As String
IntDucks = Forms!Frm_Contestants!Ducks
stDocName = "Qry_PurchaseDucks"
counter = 0
myNum = 0
DoCmd.SetWarnings False
Do
myNum = myNum + 1
counter = counter + 1
DoCmd.OpenQuery stDocName
Loop Until myNum = IntDucks
DoCmd.SetWarnings True
DoCmd.Requery
RunCommand acCmdRecordsGoToLast
End Sub
Any suggestions?
Fred
furquhart AT hospiceanswers dot Not-For_Profit