Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: delete the source table for a displayed listbox

Geek News

delete the source table for a displayed listbox
Jim <josmith2[ at ]sssnet.com> 11/23/2008 7:03:15 PM
I'm running Access 2003.

I have a listbox on my form that will contain data that is a result of a
query based on user input.

If I try to delete the table or run a make table query, I get an error
message saying it can't delete it because the table is in use.

Is there a way around this and still have the listbox on this form?

Jim
Re: delete the source table for a displayed listbox
Tom van Stiphout <tom7744.no.spam[ at ]cox.net> 11/23/2008 7:06:22 PM
On Sun, 23 Nov 2008 14:03:15 -0500, Jim <josmith2[ at ]sssnet.com> wrote:

myListbox.RowSource = ""
'Delete the table

-Tom.
Microsoft Access MVP


[Quoted Text]
>I'm running Access 2003.
>
>I have a listbox on my form that will contain data that is a result of a
>query based on user input.
>
>If I try to delete the table or run a make table query, I get an error
>message saying it can't delete it because the table is in use.
>
>Is there a way around this and still have the listbox on this form?
>
>Jim
Re: delete the source table for a displayed listbox
Jim <josmith2[ at ]sssnet.com> 11/23/2008 9:30:11 PM
Thanks that cleared the delete problem but now after I run the query to
make the table and set the listbox visible I get a blank box.

lst_2Bprinted.Visible = False
lst_2Bprinted.RowSource = ""
DoCmd.DeleteObject acTable, "tbl_apLabels"

lst_2Bprinted.RowSource = "qry_apLabels"

DoCmd.OpenQuery "qry_EnvAdrList", acViewNormal
lst_2Bprinted.Visible = True
Me.Repaint
======
qry_apLabels is a subset of tbl_aplabels and is the row source for the
listbox. If I take out all delete and the openQuery - just display
qry_apLabels the listbox works.


Jim

Tom van Stiphout wrote:
[Quoted Text]
> On Sun, 23 Nov 2008 14:03:15 -0500, Jim <josmith2[ at ]sssnet.com> wrote:
>
> myListbox.RowSource = ""
> 'Delete the table
>
> -Tom.
> Microsoft Access MVP
>
>
>> I'm running Access 2003.
>>
>> I have a listbox on my form that will contain data that is a result of a
>> query based on user input.
>>
>> If I try to delete the table or run a make table query, I get an error
>> message saying it can't delete it because the table is in use.
>>
>> Is there a way around this and still have the listbox on this form?
>>
>> Jim

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net