Im having real trouble getting a DataGrid to refresh after updating the ResordSource of a bound DataControl.
I have a DataControl, DataGrid, TextBox and CommandButton on a form.
This bit of code works OK when it is first run:
But changing the RecordSource text and running it a second time has no effect of the DataGrid?
Any advice would be appreciated - this is really starting to drive me nuts!
I have a DataControl, DataGrid, TextBox and CommandButton on a form.
This bit of code works OK when it is first run:
Code:
Private Sub cmdRun_Click()
With adodcSQL
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strMDBPath & "\" & strMDBName & ";User Id=admin;Password="
.ConnectionTimeout = 10
.CommandTimeout = 30
.CommandType = adCmdText
.LockType = adLockReadOnly
.RecordSource = txtSQL.Text
End With
With dgridSQL
Set .DataSource = adodcSQL
.ReBind
.Refresh
End With
End Sub
But changing the RecordSource text and running it a second time has no effect of the DataGrid?
Any advice would be appreciated - this is really starting to drive me nuts!