Error 3211- The database engine could not lock table

D

diegov

Hi,

I have 2 combo boxes. My aim is to fill the 2nd combo dinamically, by the
choice on the 1st combo.
With the event onchange of the 1st combo I create a table with docmd.runsql
"select...-into...mytable". The 2nd combo rowsource is a query on mytable.
Matre of the fact is that the 1st time I use it everything works fine but...
after anothe choice I get the error "Error 3211- The database engine could
not lock table"

Any Idea?

Thanks in advance
 
J

John W. Vinson

Hi,

I have 2 combo boxes. My aim is to fill the 2nd combo dinamically, by the
choice on the 1st combo.
With the event onchange of the 1st combo I create a table with docmd.runsql
"select...-into...mytable". The 2nd combo rowsource is a query on mytable.
Matre of the fact is that the 1st time I use it everything works fine but...
after anothe choice I get the error "Error 3211- The database engine could
not lock table"

Any Idea?

Thanks in advance

Creating a *BRAND NEW TABLE* every time you change the first combo - or even
filling an existing table - is a horribly inefficient and bloat-prone way to
do this.

Instead, simply base the second combo on a Query selecting records from its
table, using the first combo as a query criterion:

=[Forms]![YourFormName]![FirstComboName]

as a criterion. Requery the second combo in the afterupdate event of the
first.
 
L

Linaa

gjgj
John W. Vinson said:
Hi,

I have 2 combo boxes. My aim is to fill the 2nd combo dinamically, by the
choice on the 1st combo.
With the event onchange of the 1st combo I create a table with
docmd.runsql
"select...-into...mytable". The 2nd combo rowsource is a query on mytable.
Matre of the fact is that the 1st time I use it everything works fine
but...
after anothe choice I get the error "Error 3211- The database engine could
not lock table"

Any Idea?

Thanks in advance

Creating a *BRAND NEW TABLE* every time you change the first combo - or
even
filling an existing table - is a horribly inefficient and bloat-prone way
to
do this.

Instead, simply base the second combo on a Query selecting records from
its
table, using the first combo as a query criterion:

=[Forms]![YourFormName]![FirstComboName]

as a criterion. Requery the second combo in the afterupdate event of the
first.
 
D

diegov

I got it. Thanks to you John!

Diego

John W. Vinson said:
Hi,

I have 2 combo boxes. My aim is to fill the 2nd combo dinamically, by the
choice on the 1st combo.
With the event onchange of the 1st combo I create a table with
docmd.runsql
"select...-into...mytable". The 2nd combo rowsource is a query on mytable.
Matre of the fact is that the 1st time I use it everything works fine
but...
after anothe choice I get the error "Error 3211- The database engine could
not lock table"

Any Idea?

Thanks in advance

Creating a *BRAND NEW TABLE* every time you change the first combo - or
even
filling an existing table - is a horribly inefficient and bloat-prone way
to
do this.

Instead, simply base the second combo on a Query selecting records from
its
table, using the first combo as a query criterion:

=[Forms]![YourFormName]![FirstComboName]

as a criterion. Requery the second combo in the afterupdate event of the
first.
 
D

denzel

diegov said:
Hi,

I have 2 combo boxes. My aim is to fill the 2nd combo dinamically, by the
choice on the 1st combo.
With the event onchange of the 1st combo I create a table with
docmd.runsql "select...-into...mytable". The 2nd combo rowsource is a
query on mytable. Matre of the fact is that the 1st time I use it
everything works fine but... after anothe choice I get the error "Error
3211- The database engine could not lock table"

Any Idea?

Thanks in advance
 
J

John W. Vinson

Glad to help. Do run Tools... Database Utilities... Compact and Repair to
recover the space from your previous attempts, if you haven't already done so!
I got it. Thanks to you John!

Diego

John W. Vinson said:
Hi,

I have 2 combo boxes. My aim is to fill the 2nd combo dinamically, by the
choice on the 1st combo.
With the event onchange of the 1st combo I create a table with
docmd.runsql
"select...-into...mytable". The 2nd combo rowsource is a query on mytable.
Matre of the fact is that the 1st time I use it everything works fine
but...
after anothe choice I get the error "Error 3211- The database engine could
not lock table"

Any Idea?

Thanks in advance

Creating a *BRAND NEW TABLE* every time you change the first combo - or
even
filling an existing table - is a horribly inefficient and bloat-prone way
to
do this.

Instead, simply base the second combo on a Query selecting records from
its
table, using the first combo as a query criterion:

=[Forms]![YourFormName]![FirstComboName]

as a criterion. Requery the second combo in the afterupdate event of the
first.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top