Delete Problems

D

Derek Brown

Hi All

When I delete a record from the main form, a query that selects data for the
subform asks for a parameter value that is normally obtained from a toggle
button within the subform. How can I stop this?

This is the SQL of the sub-subform

SELECT Item.InvoiceCode, Item.ItemNumber, Item.ProductID, Item.Product,
Item.Description, Item.Quantities, Item.RetailPrice, Item.WholesalePrice,
Item.Category, Item.Quantity, [Quantity]*[RetailPrice] AS TotalItem,
Item.InvoiceNumber, Item.Paid
FROM Item
WHERE (((Item.Paid)=0 Or
(Item.Paid)=[Forms]![SchoolsForm]![InvoiceForm].[Form]![ItemForm].[Form]![ActivityFrame]));
 
D

Douglas J. Steele

[Forms]![SchoolsForm]![InvoiceForm].[Form]![ItemForm].[Form]![ActivityFrame]
would appear to be referring to a control on a subform on a subform on a
form.

Your main form is SchoolsForm. On that form is a control named InvoiceForm
(note that the name of the control that holds the subform may or may not be
the same name as the form that's being used as a subform). On whatever form
is contained in the control named InvoiceForm is a control named ItemForm.
On whatever form is contained in the control named ItemForm is a control
named ActivityFrame, and you're trying to use the value of ActivityFrame in
your query. Is that what you're expecting, or something else?

If ActivityFrame is a toggle button, its value is going to be 0 or -1. Is
that what you're expecting?
 
D

Derek Brown

Precisely

All works great until I delete a complete record from the main form then the
query asks for parameters
[Forms]![SchoolsForm]![InvoiceForm].[Form]![ItemForm].[Form]![ActivityFrame]
.. Curiously enough it asks for them Twice?

Douglas J. Steele said:
[Forms]![SchoolsForm]![InvoiceForm].[Form]![ItemForm].[Form]![ActivityFrame]
would appear to be referring to a control on a subform on a subform on a
form.

Your main form is SchoolsForm. On that form is a control named InvoiceForm
(note that the name of the control that holds the subform may or may not
be the same name as the form that's being used as a subform). On whatever
form is contained in the control named InvoiceForm is a control named
ItemForm. On whatever form is contained in the control named ItemForm is a
control named ActivityFrame, and you're trying to use the value of
ActivityFrame in your query. Is that what you're expecting, or something
else?

If ActivityFrame is a toggle button, its value is going to be 0 or -1. Is
that what you're expecting?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Derek Brown said:
Hi All

When I delete a record from the main form, a query that selects data for
the
subform asks for a parameter value that is normally obtained from a
toggle
button within the subform. How can I stop this?

This is the SQL of the sub-subform

SELECT Item.InvoiceCode, Item.ItemNumber, Item.ProductID, Item.Product,
Item.Description, Item.Quantities, Item.RetailPrice, Item.WholesalePrice,
Item.Category, Item.Quantity, [Quantity]*[RetailPrice] AS TotalItem,
Item.InvoiceNumber, Item.Paid
FROM Item
WHERE (((Item.Paid)=0 Or
(Item.Paid)=[Forms]![SchoolsForm]![InvoiceForm].[Form]![ItemForm].[Form]![ActivityFrame]));
 
D

Douglas J. Steele

Are you certain you haven't got a typo in the name of what you've typed as a
parameter?

Asking for them twice would imply that the parameter appears twice in the
SQL. What's the actual SQL you're using?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Derek Brown said:
Precisely

All works great until I delete a complete record from the main form then
the query asks for parameters
[Forms]![SchoolsForm]![InvoiceForm].[Form]![ItemForm].[Form]![ActivityFrame]
. Curiously enough it asks for them Twice?

Douglas J. Steele said:
[Forms]![SchoolsForm]![InvoiceForm].[Form]![ItemForm].[Form]![ActivityFrame]
would appear to be referring to a control on a subform on a subform on a
form.

Your main form is SchoolsForm. On that form is a control named
InvoiceForm (note that the name of the control that holds the subform may
or may not be the same name as the form that's being used as a subform).
On whatever form is contained in the control named InvoiceForm is a
control named ItemForm. On whatever form is contained in the control
named ItemForm is a control named ActivityFrame, and you're trying to use
the value of ActivityFrame in your query. Is that what you're expecting,
or something else?

If ActivityFrame is a toggle button, its value is going to be 0 or -1. Is
that what you're expecting?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Derek Brown said:
Hi All

When I delete a record from the main form, a query that selects data for
the
subform asks for a parameter value that is normally obtained from a
toggle
button within the subform. How can I stop this?

This is the SQL of the sub-subform

SELECT Item.InvoiceCode, Item.ItemNumber, Item.ProductID, Item.Product,
Item.Description, Item.Quantities, Item.RetailPrice,
Item.WholesalePrice, Item.Category, Item.Quantity,
[Quantity]*[RetailPrice] AS TotalItem, Item.InvoiceNumber, Item.Paid
FROM Item
WHERE (((Item.Paid)=0 Or
(Item.Paid)=[Forms]![SchoolsForm]![InvoiceForm].[Form]![ItemForm].[Form]![ActivityFrame]));
 
Top