Everything is all right up until the point where you start the with block. First of all, what is rsDrs? I'm assuming this was meant to be ds. With that assumption, you should have something like this:
With ds
Set .ActiveConnection = cnn
.CursorLocation = adUseClient
.CursorType = adOpenForwardOnly
.LockType = adOpenForwardOnly
.Source = selectDrssql
.Open
Set .ActiveConnection = Nothing
End With
Set dtgDRS.DataSource = ds ' I'm assuming this is the datagrid?
I'm not sure you want to set the connection to Nothing and if you want to be able to edit the contents of the grid, you'll need to use a different CursorType and LockType. The biggest error I can see is that when you are assigning an object to a property, you need to use Set. In other words Set Something.Property = Object instead of Something.Property = Object.
See if that helps.
|