One easy way to avoid mistakes like that is to let Visual Studio do it for you. When you are in code view, if you look at the drop down boxes at the top of the code page you should see one on the left that lets you pick an object/control and one of the right that shows you all of the events that the control you selected in the left drop down box has. If you select one of these events then VS will create the event handler for youhee hee hee ummmmmm I'm guessing this shows my total lack of experience with VB2005. No, i did not have the Handles portion of my Sub. Didn't even see that I had missed it, so thank you for showing me that.
As for your error, it is because as the error says - you have not set the Connection property. So simply tell it that you want it to use the OledbConnection object that you created like so:
vb Code:
SelectCmd.Connection = connection
One thing I have just noticed though is that you are mixing the SQLClient and OleDb classes together - I dont know if that will work. I've only ever used the SQLClient classes myself but I assume there is an OleDb equivalent of SqlCommand and SqlDataAdapter etc that you should be using if you are working with Access






Reply With Quote