I have an ADODC2 control with its properties established to link it to a MS Access database. Datagrid2 displays to the user the content of the specified Table of that database. All this works fine.

My wish now is that the user may type into a Text box (Text83) another Table number in the selfsame database (eg. "Table3" instead of "Table2"). I therefore need the program to be able to alter the ADODC's RecordSource property to what the user has entered in that Text Box.

Try as I may, I can not get it to work. I get errors 3704 and 3705 coming up, then when I write code which does not give rise to errors the RecordSource of the ADODC seems to update OK, but the associated Datagrid when displayed is blank. It is as if I need to re-draw that Datagrid, but how?

My current code is :-



If Adodc2.Recordset.State = adStateOpen Then Adodc2.Recordset.Close

Dim SOURCETABLE As String

SOURCETABLE = Text83

Adodc2.Recordset.Source = Text83 'Text83 starts as "Table2" but the user may specify another file path therein eg. "Table2 dd-mm-yy"

Adodc2.Recordset.Open



I bet there is a very simple answer to this, but none of my books, nor MSDN, seem to help. Suggestions would be much appreciated.


camoore

Wales, UK