Enter Parameter Pop up when Deleting a table column

P

poalman

Hi,
I'm in the process of putting together a database for work and I'm
running into a bit of trouble on one of my forms

I'm running the following code on an on click event procedure on a
form amongst other things

id = Me.List1.Value
DoCmd.RunSQL "ALTER TABLE tblUsers DROP COLUMN " & id

When clicking the button the code successfully removes the correct
column (the column with the same name as the value highlighted in the
List1 list box.

But the problem I have is Access throws up a diaglog window that says
"Enter Parameter Value" then followed by the List1 value and an empty
text field. This interupts the VB code from running to the end of the
sub, and well is needless as that line of code has already worked.

I've tried playing with 'DoCmd.SetWarnings False' but still getting
the same problem.

Any help would be greatly appreciated!

Thanks!

Paul.
 
G

Graham Mandeno

Hi Paul

Have you tried CurrentDb.Execute instead of DoCmd.RunSQL? It might pay to
bypass the Access query parser and pass the command directly to Jet.
 

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