K
keliie
Hello,
I have an index form which displays menu items (e.g., filet mignon) and
their associated prices (e.g., 1/1/2006 - $30). When I delete a record
from the form (i.e., right click, delete record), the price data is
deleted, but the menu item is not deleted. More specifically, when the
form is refreshed the menu item reappears, but the price fields are
null. I have an inkling that the issue is due to the underlying form's
query; in particular the use of the "In" operator for the subquery
located in the Price_ID fields criteria.
My question: does anyone have any idea why this is happening and what I
can do to fix it?
Details:
tblMenuMaster:
Menu_Description_ID (key field)
Menu_Category
Menu_Type
Menu_Memo
tblMenuPrice:
Price_ID (key field)
Company_Location
Menu_Price_Date
Menu_Description_ID
Menu_Item_Price
1:M link on Menu_Description_ID
Source query on aforementioned form:
SELECT
tblMenuMaster.Menu_Item_ID, tblMenuMaster.Menu_Category,
tblMenuMaster.Menu_Type, tblMenuMaster.Menu_Description_ID,
tblMenuMaster.Menu_Memo, tblMenuPrice.Price_ID,
tblMenuPrice.Menu_Price_Date, tblMenuPrice.Menu_Item_Price
FROM
tblMenuMaster LEFT JOIN tblMenuPrice ON
tblMenuMaster.Menu_Description_ID = tblMenuPrice.Menu_Description_ID
WHERE
(((tblMenuPrice.Price_ID)
In (SELECT tblMenuPrice.Price_ID
FROM [SELECT tblMenuPrice.Menu_Description_ID,
Max(tblMenuPrice.Menu_Price_Date)
AS LastDate FROM tblMenuPrice GROUP BY
tblMenuPrice.Menu_Description_ID ].
AS M INNER JOIN tblMenuPrice ON
(M.Menu_Description_ID = tblMenuPrice.Menu_Description_ID)
AND (M.LastDate = tblMenuPrice.Menu_Price_Date))
Or (tblMenuPrice.Price_ID) Is Null)
AND ((Len([tblMenuMaster].[Menu_Description_ID]))>='0'
Or (Len([tblMenuMaster].[Menu_Description_ID])) Is Null)
AND ((Len([tblMenuMaster].[Menu_Category]))>='0'
Or (Len([tblMenuMaster].[Menu_Category])) Is Null)
AND ((Len([tblMenuMaster].[Menu_Type]))>='0'
Or (Len([tblMenuMaster].[Menu_Type])) Is Null))
ORDER BY
tblMenuMaster.Menu_Category, tblMenuMaster.Menu_Type,
tblMenuMaster.Menu_Description_ID;
I have an index form which displays menu items (e.g., filet mignon) and
their associated prices (e.g., 1/1/2006 - $30). When I delete a record
from the form (i.e., right click, delete record), the price data is
deleted, but the menu item is not deleted. More specifically, when the
form is refreshed the menu item reappears, but the price fields are
null. I have an inkling that the issue is due to the underlying form's
query; in particular the use of the "In" operator for the subquery
located in the Price_ID fields criteria.
My question: does anyone have any idea why this is happening and what I
can do to fix it?
Details:
tblMenuMaster:
Menu_Description_ID (key field)
Menu_Category
Menu_Type
Menu_Memo
tblMenuPrice:
Price_ID (key field)
Company_Location
Menu_Price_Date
Menu_Description_ID
Menu_Item_Price
1:M link on Menu_Description_ID
Source query on aforementioned form:
SELECT
tblMenuMaster.Menu_Item_ID, tblMenuMaster.Menu_Category,
tblMenuMaster.Menu_Type, tblMenuMaster.Menu_Description_ID,
tblMenuMaster.Menu_Memo, tblMenuPrice.Price_ID,
tblMenuPrice.Menu_Price_Date, tblMenuPrice.Menu_Item_Price
FROM
tblMenuMaster LEFT JOIN tblMenuPrice ON
tblMenuMaster.Menu_Description_ID = tblMenuPrice.Menu_Description_ID
WHERE
(((tblMenuPrice.Price_ID)
In (SELECT tblMenuPrice.Price_ID
FROM [SELECT tblMenuPrice.Menu_Description_ID,
Max(tblMenuPrice.Menu_Price_Date)
AS LastDate FROM tblMenuPrice GROUP BY
tblMenuPrice.Menu_Description_ID ].
AS M INNER JOIN tblMenuPrice ON
(M.Menu_Description_ID = tblMenuPrice.Menu_Description_ID)
AND (M.LastDate = tblMenuPrice.Menu_Price_Date))
Or (tblMenuPrice.Price_ID) Is Null)
AND ((Len([tblMenuMaster].[Menu_Description_ID]))>='0'
Or (Len([tblMenuMaster].[Menu_Description_ID])) Is Null)
AND ((Len([tblMenuMaster].[Menu_Category]))>='0'
Or (Len([tblMenuMaster].[Menu_Category])) Is Null)
AND ((Len([tblMenuMaster].[Menu_Type]))>='0'
Or (Len([tblMenuMaster].[Menu_Type])) Is Null))
ORDER BY
tblMenuMaster.Menu_Category, tblMenuMaster.Menu_Type,
tblMenuMaster.Menu_Description_ID;