when making a component (ocx file) of the combo box, and the wear components of the user control, then I compile it into ocx files. Once finished I include the components of it into the main program. then I do click and drag the combo box to the form, but that happens there is an error message "object variable or with block variable not set", what is causing it.
Meanwhile, when I compile the component made ​​no errors at all

please help to enlighten thank you for your help
warm regards

3 Years
Discussion Span
Last Post by fx.eko

It's been a while since I've done vb, but as I recall that is just a generic error indicating some class is not present that it needs to load. I've encountered it in the com and classic asp context in the past and usually I debug it by going into the system event log in windows and looking though the errors to see if some more useful context shows up (such as which class cannot be found). This is off the top of my head, but I want to say it would be in the application events log.

I'll let others chime in here with hopefully some more useful debugging info for you.


"iwannabesedated" thanks for your reply, I will try to re-check the component that I created

best regards


It's hard to be specific without seeing the code but generally the problem is because you declared a reference to an object but did not actually create an instance. It's the difference between

Dim myobj As SomeObject         'a reference to SomeObject


Dim myobj As New SomeObject     'an instance of SomeObject

ok heres the thing as i know it.
ill just relate to how ive come across the same error and hadndled it in excel vba.
when for instance i want to declares a range then put something in it, ill dimension it just as a range, but then i use variables like row and column number to set it. Without setting it i get the error..

After setting it, no error.
To set it, i use the statement like set xrange = activesheet.cells(x,y) where x and y are integers

i hopethis helps u eko. im looking into the same thing and if need be ill be still here.


@ Reverend jim @ fourty and thank you for your reply, after I double check my program turns out I have forgotten to define / wrong in defining variable in the class / component that I created

warm regards

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.