Hello everyone -
I have a form (frmReceiptEntry) which contains a subform (sfrmReceiptDetails).
The form/subform design works fine as it is. I was approached by a user to see if I could stop an error message she receives when she accidently starts to enter a line she doesn't need.
The error message appears when the user is in the subform entering the detail lines of the receipt (i.e. entering the item code, lot #, container ID and quantity. Item code is a primary key field in the table (tblItems). When you start entering an item code, the database assigns the record a line number which is used on invoices.
Here is where the problem occurs: She is entering a receipt and accidently starts entering an item code after the last item was entered. The next line number is assigned automatically. She deletes the item code that she entered in error but when she tries to move off the record or close the form, an error message pop up that says "You tried to assign the Null value to a variable that is not a Variant data type". I'm assuming that is becasue it is looking for a match in tblItems and can't find one but I don't know that for sure.
Is there a way to avoid this error message if a new record is accidently started? The database was created in Access 2003 and the sql for the query that feeds the subform is below.
SELECT tblReceiptDetails.ReceiptNumber, tblReceipts.ReceiptDate, tblReceiptDetails.LineNumber, tblReceiptDetails.ItemCode, tblItems.Description, tblItems.UOM, tblItems.Customer, tblItems.QtyPerPallet, tblItems.UOMWeight, tblReceiptDetails.LotNumber, tblReceiptDetails.ContainerID, tblReceiptDetails.QtyReceived, tblReceiptDetails.PutawayLocation, tblReceiptDetails.OrderQtyTaken, tblReceiptDetails.PrintOnPickSheet, [QtyReceived]/[QtyPerPallet] AS PalletQty1, IIf([PalletQty1]-Int([PalletQty1])<>0,Int([PalletQty1])+1,Int([PalletQty1])) AS PalletQty, IIf([UOM]="PL",[UOMWeight]*[PalletQty],[UOMWeight]*[QtyReceived]) AS LineWeight, tblReceiptDetails.QtyAvailable, tblReceiptDetails.AnniversaryInvoiceDate
FROM tblReceipts INNER JOIN (tblReceiptDetails INNER JOIN tblItems ON tblReceiptDetails.ItemCode = tblItems.ItemCode) ON tblReceipts.ReceiptNumber = tblReceiptDetails.ReceiptNumber;
Thank you in advance.
I have a form (frmReceiptEntry) which contains a subform (sfrmReceiptDetails).
The form/subform design works fine as it is. I was approached by a user to see if I could stop an error message she receives when she accidently starts to enter a line she doesn't need.
The error message appears when the user is in the subform entering the detail lines of the receipt (i.e. entering the item code, lot #, container ID and quantity. Item code is a primary key field in the table (tblItems). When you start entering an item code, the database assigns the record a line number which is used on invoices.
Here is where the problem occurs: She is entering a receipt and accidently starts entering an item code after the last item was entered. The next line number is assigned automatically. She deletes the item code that she entered in error but when she tries to move off the record or close the form, an error message pop up that says "You tried to assign the Null value to a variable that is not a Variant data type". I'm assuming that is becasue it is looking for a match in tblItems and can't find one but I don't know that for sure.
Is there a way to avoid this error message if a new record is accidently started? The database was created in Access 2003 and the sql for the query that feeds the subform is below.
SELECT tblReceiptDetails.ReceiptNumber, tblReceipts.ReceiptDate, tblReceiptDetails.LineNumber, tblReceiptDetails.ItemCode, tblItems.Description, tblItems.UOM, tblItems.Customer, tblItems.QtyPerPallet, tblItems.UOMWeight, tblReceiptDetails.LotNumber, tblReceiptDetails.ContainerID, tblReceiptDetails.QtyReceived, tblReceiptDetails.PutawayLocation, tblReceiptDetails.OrderQtyTaken, tblReceiptDetails.PrintOnPickSheet, [QtyReceived]/[QtyPerPallet] AS PalletQty1, IIf([PalletQty1]-Int([PalletQty1])<>0,Int([PalletQty1])+1,Int([PalletQty1])) AS PalletQty, IIf([UOM]="PL",[UOMWeight]*[PalletQty],[UOMWeight]*[QtyReceived]) AS LineWeight, tblReceiptDetails.QtyAvailable, tblReceiptDetails.AnniversaryInvoiceDate
FROM tblReceipts INNER JOIN (tblReceiptDetails INNER JOIN tblItems ON tblReceiptDetails.ItemCode = tblItems.ItemCode) ON tblReceipts.ReceiptNumber = tblReceiptDetails.ReceiptNumber;
Thank you in advance.