Thanks for your advice but I still can't get it to work. This is the
closest
I have been able to get to it working
Private Sub Price_AfterUpdate()
Dim vty As Integer, grd As Integer, sze As Integer, blk As Integer
Dim pNo As Integer
Dim ctleft As Single
vty = Int(DLookup("ProductVarietyID", "ProductVarieties",
"ProductVarietyName = """ & Me.ProductVarietyName & """"))
grd = DLookup("ProductGradeID", "ProductGrade", "ProductGradeName=""" &
Me.ProductGradeName & """")
sze = DLookup("ProductSizeID", "ProductSize", "ProductSize=""" &
Me.ProductSize & """")
blk = DLookup("BlockDetailsID", "ProductionBatch", "PalletNoID=" &
Me.PalletNoID & "and ProductVarietyID =" & vty & "and ProductGradeID =" &
grd
& "and ProductSizeID =" & sze & "and Price = " & Me.Price.OldValue)
pNo = Me.PalletNoID
If CountSold < Count_prod Then
ctleft = Count_prod - CountSold
DoCmd.RunSQL "INSERT INTO ProductionBatch ( PalletNoID ,
BlockDetailsID , ProductVarietyID , ProductSizeID, ProductGradeID,
[Count],
Price, CountSold, FullySold ) Values", (pNo) & "," & Int((blk)) & "," &
([vty]) & "," & ([sze]) & "," & ([grd]) & "," & ([ctleft]) & "," & 0 & ","
&
0 & "," & No
End If
End Sub
It keeps getting values for "PalletNoID","BlockDetailsID"..etc from the
Form. pNo, blk, vty...etc are all showing the correct values. These are
either default zeros or are found from other tables using DLookUp or from
the form.
The fields in tblProductionBatch are Integer, Integer, Integer, Integer,
Integer, Single, Single, Single, Y/N
Hope to hear from you soon
Regards Dennis
dhowe said:
What is the syntax to insert a new record into a Table. The table has
nine
fields, some text and some numeric: eg a,b and c are text and v,w,x,y and
z
are numeric.
I am using Access 2003
Thank You
dhowe