A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

DELETE query error message



 
 
Thread Tools Display Modes
  #1  
Old October 21st, 2004, 01:57 PM
HeatherD25
external usenet poster
 
Posts: n/a
Default DELETE query error message

Hi,

I am trying to perform a delete query from a form. I created a button that
invokes the query. When I perform the action I get the message that says
"The table 'Project Master' is already opened exclusively by another user, or
it is already open through the user interface and cannot be manipulated
programmatically." and it won't let me delete.

Here's my SQL for the delete:
DELETE [Project Master].*, [WS-A Scoring-BP].*, [Project Master].[Project
Number], [WS-A Scoring-BP].[Project Number], *
FROM [Project Master] INNER JOIN [WS-A Scoring-BP] ON [Project
Master].[Project Number] = [WS-A Scoring-BP].[Project Number]
WHERE ((([Project Master].[Project Number])=[Forms]![Project
Master]![Project Number]) AND (([WS-A Scoring-BP].[Project
Number])=[Forms]![Project Master]![Project Number]));

Also, I'm working on this database after someone else created most of it.
Is there a setting that maybe they turned on that loks up the tables when a
form is open?

Thanks!!!

Heather

  #2  
Old October 21st, 2004, 02:23 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

Is the form that you're using bound to the table Project Master? Or to a
query that is using Project Master as a source table?

--

Ken Snell
MS ACCESS MVP

"HeatherD25" wrote in message
...
Hi,

I am trying to perform a delete query from a form. I created a button

that
invokes the query. When I perform the action I get the message that says
"The table 'Project Master' is already opened exclusively by another user,

or
it is already open through the user interface and cannot be manipulated
programmatically." and it won't let me delete.

Here's my SQL for the delete:
DELETE [Project Master].*, [WS-A Scoring-BP].*, [Project Master].[Project
Number], [WS-A Scoring-BP].[Project Number], *
FROM [Project Master] INNER JOIN [WS-A Scoring-BP] ON [Project
Master].[Project Number] = [WS-A Scoring-BP].[Project Number]
WHERE ((([Project Master].[Project Number])=[Forms]![Project
Master]![Project Number]) AND (([WS-A Scoring-BP].[Project
Number])=[Forms]![Project Master]![Project Number]));

Also, I'm working on this database after someone else created most of it.
Is there a setting that maybe they turned on that loks up the tables when

a
form is open?

Thanks!!!

Heather



  #3  
Old October 21st, 2004, 02:29 PM
HeatherD25
external usenet poster
 
Posts: n/a
Default

The command button to delete the entry is on the form called "Project Master
- TEST". The data that is displayed on this form comes from the table
"Project Master". Does that help?

"Ken Snell [MVP]" wrote:

Is the form that you're using bound to the table Project Master? Or to a
query that is using Project Master as a source table?

--

Ken Snell
MS ACCESS MVP

"HeatherD25" wrote in message
...
Hi,

I am trying to perform a delete query from a form. I created a button

that
invokes the query. When I perform the action I get the message that says
"The table 'Project Master' is already opened exclusively by another user,

or
it is already open through the user interface and cannot be manipulated
programmatically." and it won't let me delete.

Here's my SQL for the delete:
DELETE [Project Master].*, [WS-A Scoring-BP].*, [Project Master].[Project
Number], [WS-A Scoring-BP].[Project Number], *
FROM [Project Master] INNER JOIN [WS-A Scoring-BP] ON [Project
Master].[Project Number] = [WS-A Scoring-BP].[Project Number]
WHERE ((([Project Master].[Project Number])=[Forms]![Project
Master]![Project Number]) AND (([WS-A Scoring-BP].[Project
Number])=[Forms]![Project Master]![Project Number]));

Also, I'm working on this database after someone else created most of it.
Is there a setting that maybe they turned on that loks up the tables when

a
form is open?

Thanks!!!

Heather




  #4  
Old October 21st, 2004, 05:46 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

Yes, the form is bound to the table Project Master. So what you're getting
is an error message telling you that the form already has opened the table
Project Master and the query cannot "lock" the table so that it can delete
the records. You'll need to close the original form first or at least unlock
the record(s) that are being edited on that form, before you run the query.

Is the button for deleting the records being clicked while a record is being
edited? Can you tell us more about the form's setup?

--

Ken Snell
MS ACCESS MVP


"HeatherD25" wrote in message
...
The command button to delete the entry is on the form called "Project

Master
- TEST". The data that is displayed on this form comes from the table
"Project Master". Does that help?

"Ken Snell [MVP]" wrote:

Is the form that you're using bound to the table Project Master? Or to a
query that is using Project Master as a source table?

--

Ken Snell
MS ACCESS MVP

"HeatherD25" wrote in message
...
Hi,

I am trying to perform a delete query from a form. I created a button

that
invokes the query. When I perform the action I get the message that

says
"The table 'Project Master' is already opened exclusively by another

user,
or
it is already open through the user interface and cannot be

manipulated
programmatically." and it won't let me delete.

Here's my SQL for the delete:
DELETE [Project Master].*, [WS-A Scoring-BP].*, [Project

Master].[Project
Number], [WS-A Scoring-BP].[Project Number], *
FROM [Project Master] INNER JOIN [WS-A Scoring-BP] ON [Project
Master].[Project Number] = [WS-A Scoring-BP].[Project Number]
WHERE ((([Project Master].[Project Number])=[Forms]![Project
Master]![Project Number]) AND (([WS-A Scoring-BP].[Project
Number])=[Forms]![Project Master]![Project Number]));

Also, I'm working on this database after someone else created most of

it.
Is there a setting that maybe they turned on that loks up the tables

when
a
form is open?

Thanks!!!

Heather






  #5  
Old October 21st, 2004, 06:43 PM
HeatherD25
external usenet poster
 
Posts: n/a
Default

What I have is a main form where the user enters a project number,
description, and some other information (into a table called Project Master).
Then I have 5 sub-forms set up as tabs on the bottom half of the main form.
Each of the tabs writes to a different table, but they all have "project
Number" as a foreign key (?). What i need to be able to do is click on
"Delete" on the main form and have all of the entries on each of the tabs
with the same project number deleted out of the database. I was trying to
set up a button to delete and was going to put a delete query behind the
button. I just tried deleting from one of the tabs (with the code I wrote
below) and I got the error. After I got the first tab delete code written I
was going to try and create a delete query for all of the other tabs and then
copy all of that code behind one button. What do you think? I don't know
what to do. Thanks!!

"Ken Snell [MVP]" wrote:

Yes, the form is bound to the table Project Master. So what you're getting
is an error message telling you that the form already has opened the table
Project Master and the query cannot "lock" the table so that it can delete
the records. You'll need to close the original form first or at least unlock
the record(s) that are being edited on that form, before you run the query.

Is the button for deleting the records being clicked while a record is being
edited? Can you tell us more about the form's setup?

--

Ken Snell
MS ACCESS MVP


"HeatherD25" wrote in message
...
The command button to delete the entry is on the form called "Project

Master
- TEST". The data that is displayed on this form comes from the table
"Project Master". Does that help?

"Ken Snell [MVP]" wrote:

Is the form that you're using bound to the table Project Master? Or to a
query that is using Project Master as a source table?

--

Ken Snell
MS ACCESS MVP

"HeatherD25" wrote in message
...
Hi,

I am trying to perform a delete query from a form. I created a button
that
invokes the query. When I perform the action I get the message that

says
"The table 'Project Master' is already opened exclusively by another

user,
or
it is already open through the user interface and cannot be

manipulated
programmatically." and it won't let me delete.

Here's my SQL for the delete:
DELETE [Project Master].*, [WS-A Scoring-BP].*, [Project

Master].[Project
Number], [WS-A Scoring-BP].[Project Number], *
FROM [Project Master] INNER JOIN [WS-A Scoring-BP] ON [Project
Master].[Project Number] = [WS-A Scoring-BP].[Project Number]
WHERE ((([Project Master].[Project Number])=[Forms]![Project
Master]![Project Number]) AND (([WS-A Scoring-BP].[Project
Number])=[Forms]![Project Master]![Project Number]));

Also, I'm working on this database after someone else created most of

it.
Is there a setting that maybe they turned on that loks up the tables

when
a
form is open?

Thanks!!!

Heather







  #6  
Old October 22nd, 2004, 01:05 PM
HeatherD25
external usenet poster
 
Posts: n/a
Default

Hi...

Does anyone have any ideas? I tried to build a separate form where a user
could select a project number from a drop-down box and delete it, but I still
get the same error message. It won't delete from the other table. The
person that created the db set it up as a 1-1 relationship between the
tables. Any ideas?

Thanks!!!!!!!!!

"HeatherD25" wrote:

What I have is a main form where the user enters a project number,
description, and some other information (into a table called Project Master).
Then I have 5 sub-forms set up as tabs on the bottom half of the main form.
Each of the tabs writes to a different table, but they all have "project
Number" as a foreign key (?). What i need to be able to do is click on
"Delete" on the main form and have all of the entries on each of the tabs
with the same project number deleted out of the database. I was trying to
set up a button to delete and was going to put a delete query behind the
button. I just tried deleting from one of the tabs (with the code I wrote
below) and I got the error. After I got the first tab delete code written I
was going to try and create a delete query for all of the other tabs and then
copy all of that code behind one button. What do you think? I don't know
what to do. Thanks!!

"Ken Snell [MVP]" wrote:

Yes, the form is bound to the table Project Master. So what you're getting
is an error message telling you that the form already has opened the table
Project Master and the query cannot "lock" the table so that it can delete
the records. You'll need to close the original form first or at least unlock
the record(s) that are being edited on that form, before you run the query.

Is the button for deleting the records being clicked while a record is being
edited? Can you tell us more about the form's setup?

--

Ken Snell
MS ACCESS MVP


"HeatherD25" wrote in message
...
The command button to delete the entry is on the form called "Project

Master
- TEST". The data that is displayed on this form comes from the table
"Project Master". Does that help?

"Ken Snell [MVP]" wrote:

Is the form that you're using bound to the table Project Master? Or to a
query that is using Project Master as a source table?

--

Ken Snell
MS ACCESS MVP

"HeatherD25" wrote in message
...
Hi,

I am trying to perform a delete query from a form. I created a button
that
invokes the query. When I perform the action I get the message that

says
"The table 'Project Master' is already opened exclusively by another

user,
or
it is already open through the user interface and cannot be

manipulated
programmatically." and it won't let me delete.

Here's my SQL for the delete:
DELETE [Project Master].*, [WS-A Scoring-BP].*, [Project

Master].[Project
Number], [WS-A Scoring-BP].[Project Number], *
FROM [Project Master] INNER JOIN [WS-A Scoring-BP] ON [Project
Master].[Project Number] = [WS-A Scoring-BP].[Project Number]
WHERE ((([Project Master].[Project Number])=[Forms]![Project
Master]![Project Number]) AND (([WS-A Scoring-BP].[Project
Number])=[Forms]![Project Master]![Project Number]));

Also, I'm working on this database after someone else created most of

it.
Is there a setting that maybe they turned on that loks up the tables

when
a
form is open?

Thanks!!!

Heather







  #7  
Old October 22nd, 2004, 02:31 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

So what you're wanting to do is delete the record in the parent table
(Project Master) and all the related records in the children records?

Assuming that this is so, why use a separate query to delete records when
you already have the data "open" in the form? First, go to Relationships
window and be sure that you have joins (relationships) established from
Project Master to all the children tables, using the Project Number field as
the linking field for all. Be sure that the relationships is set for
Referential Integrity and that Cascade Delete is checked "yes". By doing
this, if you delete the parent record in Project Master, all children
records will be deleted automatically as well.

Then, in your form, instead of running the delete query that you're trying
to run, just delete the record in the main form. The form will handle all
the deletions for you.

If you *must" run a separate query for some reason, then you'll need to
detach the form and subforms from the underlying tables (their record
sources need to be set to an empty string or else the main form needs to be
closed). All in all, if you can do it, I'd use the first approach noted
above.

--

Ken Snell
MS ACCESS MVP


"HeatherD25" wrote in message
...
What I have is a main form where the user enters a project number,
description, and some other information (into a table called Project

Master).
Then I have 5 sub-forms set up as tabs on the bottom half of the main

form.
Each of the tabs writes to a different table, but they all have "project
Number" as a foreign key (?). What i need to be able to do is click on
"Delete" on the main form and have all of the entries on each of the tabs
with the same project number deleted out of the database. I was trying to
set up a button to delete and was going to put a delete query behind the
button. I just tried deleting from one of the tabs (with the code I wrote
below) and I got the error. After I got the first tab delete code written

I
was going to try and create a delete query for all of the other tabs and

then
copy all of that code behind one button. What do you think? I don't know
what to do. Thanks!!

"Ken Snell [MVP]" wrote:

Yes, the form is bound to the table Project Master. So what you're

getting
is an error message telling you that the form already has opened the

table
Project Master and the query cannot "lock" the table so that it can

delete
the records. You'll need to close the original form first or at least

unlock
the record(s) that are being edited on that form, before you run the

query.

Is the button for deleting the records being clicked while a record is

being
edited? Can you tell us more about the form's setup?

--

Ken Snell
MS ACCESS MVP


"HeatherD25" wrote in message
...
The command button to delete the entry is on the form called "Project

Master
- TEST". The data that is displayed on this form comes from the table
"Project Master". Does that help?

"Ken Snell [MVP]" wrote:

Is the form that you're using bound to the table Project Master? Or

to a
query that is using Project Master as a source table?

--

Ken Snell
MS ACCESS MVP

"HeatherD25" wrote in message
...
Hi,

I am trying to perform a delete query from a form. I created a

button
that
invokes the query. When I perform the action I get the message

that
says
"The table 'Project Master' is already opened exclusively by

another
user,
or
it is already open through the user interface and cannot be

manipulated
programmatically." and it won't let me delete.

Here's my SQL for the delete:
DELETE [Project Master].*, [WS-A Scoring-BP].*, [Project

Master].[Project
Number], [WS-A Scoring-BP].[Project Number], *
FROM [Project Master] INNER JOIN [WS-A Scoring-BP] ON [Project
Master].[Project Number] = [WS-A Scoring-BP].[Project Number]
WHERE ((([Project Master].[Project Number])=[Forms]![Project
Master]![Project Number]) AND (([WS-A Scoring-BP].[Project
Number])=[Forms]![Project Master]![Project Number]));

Also, I'm working on this database after someone else created most

of
it.
Is there a setting that maybe they turned on that loks up the

tables
when
a
form is open?

Thanks!!!

Heather









  #8  
Old October 22nd, 2004, 04:35 PM
HeatherD25
external usenet poster
 
Posts: n/a
Default

Hi Ken,

Thanks so much for your help... I tried to do what you said in the 1st
method -- I went to the relationships and set them all up for referential
integrity and selected to cascade the delete. When I try to delete the
record by using a "Delete" on the main form I still get a message that says
"The table 'xxx' is already opened exclusively by another user, or it is
already open through the user interface and cannot be manipulated
programmatically". Any ideas?

Thanks!
Heather

"Ken Snell [MVP]" wrote:

So what you're wanting to do is delete the record in the parent table
(Project Master) and all the related records in the children records?

Assuming that this is so, why use a separate query to delete records when
you already have the data "open" in the form? First, go to Relationships
window and be sure that you have joins (relationships) established from
Project Master to all the children tables, using the Project Number field as
the linking field for all. Be sure that the relationships is set for
Referential Integrity and that Cascade Delete is checked "yes". By doing
this, if you delete the parent record in Project Master, all children
records will be deleted automatically as well.

Then, in your form, instead of running the delete query that you're trying
to run, just delete the record in the main form. The form will handle all
the deletions for you.

If you *must" run a separate query for some reason, then you'll need to
detach the form and subforms from the underlying tables (their record
sources need to be set to an empty string or else the main form needs to be
closed). All in all, if you can do it, I'd use the first approach noted
above.

--

Ken Snell
MS ACCESS MVP


"HeatherD25" wrote in message
...
What I have is a main form where the user enters a project number,
description, and some other information (into a table called Project

Master).
Then I have 5 sub-forms set up as tabs on the bottom half of the main

form.
Each of the tabs writes to a different table, but they all have "project
Number" as a foreign key (?). What i need to be able to do is click on
"Delete" on the main form and have all of the entries on each of the tabs
with the same project number deleted out of the database. I was trying to
set up a button to delete and was going to put a delete query behind the
button. I just tried deleting from one of the tabs (with the code I wrote
below) and I got the error. After I got the first tab delete code written

I
was going to try and create a delete query for all of the other tabs and

then
copy all of that code behind one button. What do you think? I don't know
what to do. Thanks!!

"Ken Snell [MVP]" wrote:

Yes, the form is bound to the table Project Master. So what you're

getting
is an error message telling you that the form already has opened the

table
Project Master and the query cannot "lock" the table so that it can

delete
the records. You'll need to close the original form first or at least

unlock
the record(s) that are being edited on that form, before you run the

query.

Is the button for deleting the records being clicked while a record is

being
edited? Can you tell us more about the form's setup?

--

Ken Snell
MS ACCESS MVP


"HeatherD25" wrote in message
...
The command button to delete the entry is on the form called "Project
Master
- TEST". The data that is displayed on this form comes from the table
"Project Master". Does that help?

"Ken Snell [MVP]" wrote:

Is the form that you're using bound to the table Project Master? Or

to a
query that is using Project Master as a source table?

--

Ken Snell
MS ACCESS MVP

"HeatherD25" wrote in message
...
Hi,

I am trying to perform a delete query from a form. I created a

button
that
invokes the query. When I perform the action I get the message

that
says
"The table 'Project Master' is already opened exclusively by

another
user,
or
it is already open through the user interface and cannot be
manipulated
programmatically." and it won't let me delete.

Here's my SQL for the delete:
DELETE [Project Master].*, [WS-A Scoring-BP].*, [Project
Master].[Project
Number], [WS-A Scoring-BP].[Project Number], *
FROM [Project Master] INNER JOIN [WS-A Scoring-BP] ON [Project
Master].[Project Number] = [WS-A Scoring-BP].[Project Number]
WHERE ((([Project Master].[Project Number])=[Forms]![Project
Master]![Project Number]) AND (([WS-A Scoring-BP].[Project
Number])=[Forms]![Project Master]![Project Number]));

Also, I'm working on this database after someone else created most

of
it.
Is there a setting that maybe they turned on that loks up the

tables
when
a
form is open?

Thanks!!!

Heather










  #9  
Old October 22nd, 2004, 06:06 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

What is the code running for the "Delete" button when you click it?

--

Ken Snell
MS ACCESS MVP

"HeatherD25" wrote in message
...
Hi Ken,

Thanks so much for your help... I tried to do what you said in the 1st
method -- I went to the relationships and set them all up for referential
integrity and selected to cascade the delete. When I try to delete the
record by using a "Delete" on the main form I still get a message that

says
"The table 'xxx' is already opened exclusively by another user, or it is
already open through the user interface and cannot be manipulated
programmatically". Any ideas?

Thanks!
Heather

"Ken Snell [MVP]" wrote:

So what you're wanting to do is delete the record in the parent table
(Project Master) and all the related records in the children records?

Assuming that this is so, why use a separate query to delete records

when
you already have the data "open" in the form? First, go to Relationships
window and be sure that you have joins (relationships) established from
Project Master to all the children tables, using the Project Number

field as
the linking field for all. Be sure that the relationships is set for
Referential Integrity and that Cascade Delete is checked "yes". By doing
this, if you delete the parent record in Project Master, all children
records will be deleted automatically as well.

Then, in your form, instead of running the delete query that you're

trying
to run, just delete the record in the main form. The form will handle

all
the deletions for you.

If you *must" run a separate query for some reason, then you'll need to
detach the form and subforms from the underlying tables (their record
sources need to be set to an empty string or else the main form needs to

be
closed). All in all, if you can do it, I'd use the first approach noted
above.

--

Ken Snell
MS ACCESS MVP


"HeatherD25" wrote in message
...
What I have is a main form where the user enters a project number,
description, and some other information (into a table called Project

Master).
Then I have 5 sub-forms set up as tabs on the bottom half of the main

form.
Each of the tabs writes to a different table, but they all have

"project
Number" as a foreign key (?). What i need to be able to do is click

on
"Delete" on the main form and have all of the entries on each of the

tabs
with the same project number deleted out of the database. I was

trying to
set up a button to delete and was going to put a delete query behind

the
button. I just tried deleting from one of the tabs (with the code I

wrote
below) and I got the error. After I got the first tab delete code

written
I
was going to try and create a delete query for all of the other tabs

and
then
copy all of that code behind one button. What do you think? I don't

know
what to do. Thanks!!

"Ken Snell [MVP]" wrote:

Yes, the form is bound to the table Project Master. So what you're

getting
is an error message telling you that the form already has opened the

table
Project Master and the query cannot "lock" the table so that it can

delete
the records. You'll need to close the original form first or at

least
unlock
the record(s) that are being edited on that form, before you run the

query.

Is the button for deleting the records being clicked while a record

is
being
edited? Can you tell us more about the form's setup?

--

Ken Snell
MS ACCESS MVP


"HeatherD25" wrote in message
...
The command button to delete the entry is on the form called

"Project
Master
- TEST". The data that is displayed on this form comes from the

table
"Project Master". Does that help?

"Ken Snell [MVP]" wrote:

Is the form that you're using bound to the table Project Master?

Or
to a
query that is using Project Master as a source table?

--

Ken Snell
MS ACCESS MVP

"HeatherD25" wrote in

message
...
Hi,

I am trying to perform a delete query from a form. I created

a
button
that
invokes the query. When I perform the action I get the

message
that
says
"The table 'Project Master' is already opened exclusively by

another
user,
or
it is already open through the user interface and cannot be
manipulated
programmatically." and it won't let me delete.

Here's my SQL for the delete:
DELETE [Project Master].*, [WS-A Scoring-BP].*, [Project
Master].[Project
Number], [WS-A Scoring-BP].[Project Number], *
FROM [Project Master] INNER JOIN [WS-A Scoring-BP] ON [Project
Master].[Project Number] = [WS-A Scoring-BP].[Project Number]
WHERE ((([Project Master].[Project Number])=[Forms]![Project
Master]![Project Number]) AND (([WS-A Scoring-BP].[Project
Number])=[Forms]![Project Master]![Project Number]));

Also, I'm working on this database after someone else created

most
of
it.
Is there a setting that maybe they turned on that loks up the

tables
when
a
form is open?

Thanks!!!

Heather












  #10  
Old October 22nd, 2004, 09:47 PM
HeatherD25
external usenet poster
 
Posts: n/a
Default

This is the code running behind the delete button on my main form (parent
form):


Private Sub Command67_Click()
On Error GoTo Err_Command67_Click

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_Command67_Click:
Exit Sub

Err_Command67_Click:
MsgBox Err.Description
Resume Exit_Command67_Click

End Sub

"Ken Snell [MVP]" wrote:

What is the code running for the "Delete" button when you click it?

--

Ken Snell
MS ACCESS MVP

"HeatherD25" wrote in message
...
Hi Ken,

Thanks so much for your help... I tried to do what you said in the 1st
method -- I went to the relationships and set them all up for referential
integrity and selected to cascade the delete. When I try to delete the
record by using a "Delete" on the main form I still get a message that

says
"The table 'xxx' is already opened exclusively by another user, or it is
already open through the user interface and cannot be manipulated
programmatically". Any ideas?

Thanks!
Heather

"Ken Snell [MVP]" wrote:

So what you're wanting to do is delete the record in the parent table
(Project Master) and all the related records in the children records?

Assuming that this is so, why use a separate query to delete records

when
you already have the data "open" in the form? First, go to Relationships
window and be sure that you have joins (relationships) established from
Project Master to all the children tables, using the Project Number

field as
the linking field for all. Be sure that the relationships is set for
Referential Integrity and that Cascade Delete is checked "yes". By doing
this, if you delete the parent record in Project Master, all children
records will be deleted automatically as well.

Then, in your form, instead of running the delete query that you're

trying
to run, just delete the record in the main form. The form will handle

all
the deletions for you.

If you *must" run a separate query for some reason, then you'll need to
detach the form and subforms from the underlying tables (their record
sources need to be set to an empty string or else the main form needs to

be
closed). All in all, if you can do it, I'd use the first approach noted
above.

--

Ken Snell
MS ACCESS MVP


"HeatherD25" wrote in message
...
What I have is a main form where the user enters a project number,
description, and some other information (into a table called Project
Master).
Then I have 5 sub-forms set up as tabs on the bottom half of the main
form.
Each of the tabs writes to a different table, but they all have

"project
Number" as a foreign key (?). What i need to be able to do is click

on
"Delete" on the main form and have all of the entries on each of the

tabs
with the same project number deleted out of the database. I was

trying to
set up a button to delete and was going to put a delete query behind

the
button. I just tried deleting from one of the tabs (with the code I

wrote
below) and I got the error. After I got the first tab delete code

written
I
was going to try and create a delete query for all of the other tabs

and
then
copy all of that code behind one button. What do you think? I don't

know
what to do. Thanks!!

"Ken Snell [MVP]" wrote:

Yes, the form is bound to the table Project Master. So what you're
getting
is an error message telling you that the form already has opened the
table
Project Master and the query cannot "lock" the table so that it can
delete
the records. You'll need to close the original form first or at

least
unlock
the record(s) that are being edited on that form, before you run the
query.

Is the button for deleting the records being clicked while a record

is
being
edited? Can you tell us more about the form's setup?

--

Ken Snell
MS ACCESS MVP


"HeatherD25" wrote in message
...
The command button to delete the entry is on the form called

"Project
Master
- TEST". The data that is displayed on this form comes from the

table
"Project Master". Does that help?

"Ken Snell [MVP]" wrote:

Is the form that you're using bound to the table Project Master?

Or
to a
query that is using Project Master as a source table?

--

Ken Snell
MS ACCESS MVP

"HeatherD25" wrote in

message
...
Hi,

I am trying to perform a delete query from a form. I created

a
button
that
invokes the query. When I perform the action I get the

message
that
says
"The table 'Project Master' is already opened exclusively by
another
user,
or
it is already open through the user interface and cannot be
manipulated
programmatically." and it won't let me delete.

Here's my SQL for the delete:
DELETE [Project Master].*, [WS-A Scoring-BP].*, [Project
Master].[Project
Number], [WS-A Scoring-BP].[Project Number], *
FROM [Project Master] INNER JOIN [WS-A Scoring-BP] ON [Project
Master].[Project Number] = [WS-A Scoring-BP].[Project Number]
WHERE ((([Project Master].[Project Number])=[Forms]![Project
Master]![Project Number]) AND (([WS-A Scoring-BP].[Project
Number])=[Forms]![Project Master]![Project Number]));

Also, I'm working on this database after someone else created

most
of
it.
Is there a setting that maybe they turned on that loks up the
tables
when
a
form is open?

Thanks!!!

Heather













 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Union Query Not Returning A Value Jeff G Running & Setting Up Queries 2 October 19th, 2004 05:47 PM
Button that runs a Delete Query Carol New Users 2 August 26th, 2004 10:09 PM
Delete query on external db? NoSpamTakeSquareRootOfNumber Running & Setting Up Queries 1 July 24th, 2004 02:35 PM
Delete Query based on result of select query John Finch Running & Setting Up Queries 1 July 2nd, 2004 05:47 PM
delete records that have two fields with the same value L. T. Portella New Users 9 May 14th, 2004 05:49 PM


All times are GMT +1. The time now is 12:55 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.