PC Review


Reply
Thread Tools Rate Thread

Clear Method not working for a ListBox clear

 
 
scott56hannah
Guest
Posts: n/a
 
      14th Feb 2008
Hi,

I have the following code and I am trying to clear the values in a ListBox...

If ActiveCell.Offset(i, 0) = "" Then
VendorEntry_1280x1024.RuleListBox.Clear
Exit Sub
End If

When the routine is executed it returns the following error message

Run-time error '-2147467259 (80004005)

Unspecified error.

The routine does not continue or recover...can anyone assist with this one ?

Thanks
Scott
 
Reply With Quote
 
 
 
 
paul.robinson@it-tallaght.ie
Guest
Posts: n/a
 
      14th Feb 2008
hi
Works for me when I run it from a command button on the userform.
Where are you running this code from? Is the userform visible? Is it
loaded?

regards
Paul

On Feb 14, 8:22*am, scott56hannah
<scott56han...@discussions.microsoft.com> wrote:
> Hi,
>
> I have the following code and I am trying to clear the values in a ListBox....
>
> If ActiveCell.Offset(i, 0) = "" Then
> * * * * VendorEntry_1280x1024.RuleListBox.Clear
> * * * * Exit Sub
> End If
>
> When the routine is executed it returns the following error message
>
> Run-time error '-2147467259 (80004005)
>
> Unspecified error.
>
> The routine does not continue or recover...can anyone assist with this one?
>
> Thanks
> Scott


 
Reply With Quote
 
scott56hannah
Guest
Posts: n/a
 
      14th Feb 2008
Paul,

Yes the form is visible and loaded....I am running the code from a "Refresh"
button on the form...it is not working for me....

Interestingly it goes through the initial call when the form is first
initialised and it runs this step....then after the list box is populated
with values for the first time and then I try to refresh it returns this error

Scott

"(E-Mail Removed)" wrote:

> hi
> Works for me when I run it from a command button on the userform.
> Where are you running this code from? Is the userform visible? Is it
> loaded?
>
> regards
> Paul
>
> On Feb 14, 8:22 am, scott56hannah
> <scott56han...@discussions.microsoft.com> wrote:
> > Hi,
> >
> > I have the following code and I am trying to clear the values in a ListBox....
> >
> > If ActiveCell.Offset(i, 0) = "" Then
> > VendorEntry_1280x1024.RuleListBox.Clear
> > Exit Sub
> > End If
> >
> > When the routine is executed it returns the following error message
> >
> > Run-time error '-2147467259 (80004005)
> >
> > Unspecified error.
> >
> > The routine does not continue or recover...can anyone assist with this one ?
> >
> > Thanks
> > Scott

>
>

 
Reply With Quote
 
paul.robinson@it-tallaght.ie
Guest
Posts: n/a
 
      14th Feb 2008
Hi
I can't reproduce your problem given the code snippet you posted.
Perhaps it is another part of the code causing the problem?
Paul

On Feb 14, 12:28*pm, scott56hannah
<scott56han...@discussions.microsoft.com> wrote:
> Paul,
>
> Yes the form is visible and loaded....I am running the code from a "Refresh"
> button on the form...it is not working for me....
>
> Interestingly it goes through the initial call when the form is first
> initialised and it runs this step....then after the list box is populated
> with values for the first time and then I try to refresh it returns this error
>
> Scott
>
>
>
> "paul.robin...@it-tallaght.ie" wrote:
> > hi
> > Works for me when I run it from a command button on the userform.
> > Where are you running this code from? Is the userform visible? Is it
> > loaded?

>
> > regards
> > Paul

>
> > On Feb 14, 8:22 am, scott56hannah
> > <scott56han...@discussions.microsoft.com> wrote:
> > > Hi,

>
> > > I have the following code and I am trying to clear the values in a ListBox....

>
> > > If ActiveCell.Offset(i, 0) = "" Then
> > > * * * * VendorEntry_1280x1024.RuleListBox.Clear
> > > * * * * Exit Sub
> > > End If

>
> > > When the routine is executed it returns the following error message

>
> > > Run-time error '-2147467259 (80004005)

>
> > > Unspecified error.

>
> > > The routine does not continue or recover...can anyone assist with thisone ?

>
> > > Thanks
> > > Scott- Hide quoted text -

>
> - Show quoted text -


 
Reply With Quote
 
scott56hannah
Guest
Posts: n/a
 
      14th Feb 2008
Paul,

Have now found the problem....for the Listbox I was assigning a Range value
for the values to the RowSource property. If I clear that value by assigning
a "" rather than use the .Clear action it clears all values from the
list.....looking at some doco on list boxes if you assign a range you cannot
delete or add items using the actions you must change the RowSource
assignment...

Thanks for your help

Scott

"(E-Mail Removed)" wrote:

> Hi
> I can't reproduce your problem given the code snippet you posted.
> Perhaps it is another part of the code causing the problem?
> Paul
>
> On Feb 14, 12:28 pm, scott56hannah
> <scott56han...@discussions.microsoft.com> wrote:
> > Paul,
> >
> > Yes the form is visible and loaded....I am running the code from a "Refresh"
> > button on the form...it is not working for me....
> >
> > Interestingly it goes through the initial call when the form is first
> > initialised and it runs this step....then after the list box is populated
> > with values for the first time and then I try to refresh it returns this error
> >
> > Scott
> >
> >
> >
> > "paul.robin...@it-tallaght.ie" wrote:
> > > hi
> > > Works for me when I run it from a command button on the userform.
> > > Where are you running this code from? Is the userform visible? Is it
> > > loaded?

> >
> > > regards
> > > Paul

> >
> > > On Feb 14, 8:22 am, scott56hannah
> > > <scott56han...@discussions.microsoft.com> wrote:
> > > > Hi,

> >
> > > > I have the following code and I am trying to clear the values in a ListBox....

> >
> > > > If ActiveCell.Offset(i, 0) = "" Then
> > > > VendorEntry_1280x1024.RuleListBox.Clear
> > > > Exit Sub
> > > > End If

> >
> > > > When the routine is executed it returns the following error message

> >
> > > > Run-time error '-2147467259 (80004005)

> >
> > > > Unspecified error.

> >
> > > > The routine does not continue or recover...can anyone assist with this one ?

> >
> > > > Thanks
> > > > Scott- Hide quoted text -

> >
> > - Show quoted text -

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clear listbox johnrb7865 Microsoft Excel Programming 3 29th Jul 2008 10:56 PM
Re: dataset.clear doesn't clear listbox Val Mazur Microsoft ADO .NET 2 11th Nov 2004 03:12 AM
clear listbox adriany Microsoft Access Form Coding 1 8th Jun 2004 05:24 PM
Clear a listbox in VB .net Ariel Microsoft VB .NET 5 21st Jan 2004 07:44 PM
clear the listBox simon Microsoft ASP .NET 1 5th Jan 2004 06:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:35 PM.