[AccessD] OpenRecordSet question

Stuart McLachlan stuart at lexacorp.com.pg
Fri Aug 7 19:21:30 CDT 2009


Tha's strange,  I use this sort of relinking code in just about every system I write and it's 
never caused a problem. 


Dim tbl as TableDef
...
   For Each tbl In CurrentDb.TableDefs
         If Left$(tbl.Name, 3) = "tbl" Then renewlink _
              tbl.Name, CurrentProject.Path & strBEName"
   Next
...
Function renewlink(tablename As String, datafile As String) As Long
DoCmd.DeleteObject acTable, tablename
DoCmd.TransferDatabase acLink, "Microsoft Access", datafile, _
acTable, tablename, tablename, False
End Function


-- 
Stuart

On 7 Aug 2009 at 15:59, Doug Steele wrote:

> I discovered this when I found that
> 
> Set tdf = Currentdb.Tabledefs("myTableDef")
> 
>  doesn't work, but
> 
> dim myDB as Database
> set tdf = myDB.Tabledefs("myTableDef")
> 
> does work
> 
> Doug Steele
> 
> On Fri, Aug 7, 2009 at 3:43 PM, Max Wanadoo <max.wanadoo at gmail.com> wrote:
> 
> > IMO one should always dim the DB object.
> >
> > I believe that the methods are *slightly* different when used directly from
> > CurrentDB. As opposed to from the dimensioned db.
> >
> > As an example:
> > If you do a currentdb.execute("Delete * xyz) you will not get an error
> > message
> >
> > But you will if it has been dimmed.
> >
> > Am I right?  Might be a bit confused..getting late and on my second
> > half-pint of the week.
> >
> >
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com





More information about the AccessD mailing list