Help On Transfer of forms

  • Thread starter Thread starter Dirk Goldgar
  • Start date Start date
D

Dirk Goldgar

AL FINK said:
I have the foolowing code that seems to be causing trouble
SQLstring = "SELECT MSysObjects.Name FROM MsysObjects WHERE
(Left$([Name],1)<>'~') AND " & _
'"(MSysObjects.Type)=-32768 ORDER BY MSysObjects.Name;"

Set rs = New ADODB.Recordset
rs.Open SQLstring, MyConn, _
adOpenDynamic, adLockOptimistic

With rs
Do While Not .EOF
Objname = !Name
.Update
.MoveNext
DoCmd.TransferDatabase acExport, "Microsoft Access",
Mydestination, acForms, Objname, Objname
Loop
End With

MyConn.Close
Set MyConn = Nothing

As you can see I get a list of forms from the system and then try to
tranfser the items to another database. What happens is I get a error
stating the item can not be found, does anyone have a idea why?

The most obvious reason for the error you report is that there is no
constant "acForms". You should have written "acForm".

Since I don't know how MyConn is opened, I don't know if it's pointing
to the current database, or even if you should be closing it.

Why do you call the recordset's .Update method even though you've made
no changes to the record? Also, you ought to close the recordset with
"rs.Close".
 
I have the foolowing code that seems to be causing trouble
SQLstring = "SELECT MSysObjects.Name FROM MsysObjects WHERE
(Left$([Name],1)<>'~') AND " & _
'"(MSysObjects.Type)=-32768 ORDER BY MSysObjects.Name;"

Set rs = New ADODB.Recordset
rs.Open SQLstring, MyConn, _
adOpenDynamic, adLockOptimistic

With rs
Do While Not .EOF
Objname = !Name
.Update
.MoveNext
DoCmd.TransferDatabase acExport, "Microsoft Access", Mydestination,
acForms, Objname, Objname
Loop
End With

MyConn.Close
Set MyConn = Nothing

As you can see I get a list of forms from the system and then try to
tranfser the items to another database. What happens is I get a error
stating the item can not be found, does anyone have a idea why?
 
Back
Top