Any body got any ideas on how to do this once. I can already do it with a data control and use the following code, however it get a bit tedious when you have to do it all againg for another form etc

With Data1
.DatabaseName=App.Path & "\my.mdb"
.RecordSource="mytable"
.Connect=";Pwd=password"
.Refresh
End With

some form of function could be the answer but so far I have failed in getting one to work.

charlie