Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Private Sub cmdExecute_Click() 1

Status
Not open for further replies.

tunsarod

Programmer
Oct 31, 2001
294
GB
Private Sub cmdExecute_Click()

' transfer the new 'Browse_Properties' form
DoCmd.TransferDatabase acExport, "Microsoft Access", _
"\\Peter\C\Home4You\Prog\PALMS_1001.mdb", acForm, "Browse_Properties", "Browse_Properties", -1

' transfer the new 'LettersControl' form
DoCmd.TransferDatabase acExport, "Microsoft Access", _
"\\Peter\C\Home4You\Prog\PALMS_1001.mdb", acForm, "LetterControl", "LetterControl", -1

End Sub


When ths code executes I usually get an 'Object invalid or no longer set' error message when the process gets to the second TransferDatabase operation.

I should say that this does not appear to be in any way connected to the name or type of object being transferred.

Also I use a laptop and a desktop networked together and if I use the menu option: File | SaveAs/Export to copy an object between identical databases on each machine the transfer usually works first time but if I immediately repeat the process to transfer the same or another object the error occurs. If I try the process repeatedly then sometimes, after just three or four attempts I get a warning message to the effect that the SaveAs/Export procedure isn't available.

I need to resolve this because I am trying to use this method to update my clients system by email. i.e. I include any new or modified objects in a small app called Update.mdb which includes the above code in the startup form, suitablly modified to incorporate the objects that need to be transferred. There is a 'master' copy of the front-end application kept on the server and this gets updated when my client runs the Update.mdb application from the email. Each user then grabs a copy of the updated 'master' front-end from the server as and when.

Clearly it's not going too well when this error occurs repeatedly during the update process.

Any suggestions?

 
tunsarod

I'm not really sure what's going on, and I could be way off base here, but is it possible the exporting database needs to be closed before you can export from it a second time?

Maybe someone else can clarify this.

Vic
 
Thanks for your interest Vic and good point.

Let me clarify the situation a bit more.

Consider the manual transfer of a form object from one .mdb to another. Regardless of whether the two databases are on different machines or the same machine its just the same.

The exact situation as tested a few moments ago goes like this:

1. select a form object to send
2. right click and select SaveAs/Export
3. select To an External File or Database
4. select the destination database from the Open dialogue
5. click Export
6. the Export To: dialogue opens with name of the selected objcet.
7. click OK
8. accept the warning that the object already exists (unless sending a new object)
9. transfer excutes and control is returned to the sending database window

If I now attempt to send the same form or another form object the operation fails at point 9 above with a popup message box : Object not valid or no longer set.

I now have to click OK to dismiss the message box but I find another identical message box behind the first, implying, I assume, that two references were no longer valid. Bearing in mind that this is not my code that is running but a standard access procedure.

If I now attempt to send the object a third time - it works; but if I then try to send it fourth time - it fails.

In other words every alternate attempt fails.

Now that's magic!

 
tuns

I just tried your scenario on my system, Win98/A2K, and could not generate your error. Each time I exported, the routine functioned properly.

I've even tried the export to a database residing on a WAN. Again, no errors when exporting multiple times.

So at this point, I don't have a good answer for you. I would have suggested reinstalling Access, but you are saying it happens on more than one computer. Chances that both installations are corrupted identically are pretty small.

Sorry I can't offer more.

Vic
 
Spooky !

I have exactly the same problem with an 'on click' event in an Access 97 App running under XP. The user drops a database icon on the form and the click is supposed to transfer the appropriate form and reports.
Code:
Private Sub Updatebutton_Click()
Dim info As Variant
info = HyperlinkPart(link, acAddress)
DoCmd.TransferDatabase acExport, "Microsoft Access", info, acReport, "Active Quotation", "Active Quotation"
DoCmd.TransferDatabase acExport, "Microsoft Access", info, acReport, "Proforma Invoice", "Proforma Invoice"
DoCmd.TransferDatabase acExport, "Microsoft Access", info, acForm, "Main Switchboard", "Main Switchboard"
DoCmd.TransferDatabase acExport, "Microsoft Access", info, acTable, "Saleable Stock Items", "Saleable Stock Items"
DoCmd.TransferDatabase acExport, "Microsoft Access", info, acForm, "Active Quotation", "Active Quotation"
End Sub
[\code]
It always processes the first transfer and appears to fail randomly (with error 3420 Object invalid or no longer set) thereafter. It never completes.

It would be cool if this info helped someone come up with a solution. TIA.
 
~
tunsarod

What are your operating system and Access versions?

I'm Win98 w/ Access97 -- and I've been getting the same behavior as you and Frodman, whether using code or the menus.

Has anyone found the resolution?

db

~*~*~*~*~*~
All you need is a can of WD-40 and a roll of duct tape.
~*~*~*~*~*~
 
I'm using Win98 and Access97 same as you and I've still not found the reason for the problem.

WD40 and duct tape! Surely you need a willing partner as well?

Rod
 
~
Rod:

re: WD40 and duct tape -- the partner has to be willing? ;}

re: 'Object invalid or no longer set' -- I've resolved the issue using Microsoft Knowledge Base Article - 160875 : ACC97: TransferDatabase Causes Page Fault If Object Exists

RESOLUTION
To work around the error, test for the existence of the object in the target database and delete it before you use TransferDatabase

STATUS
Microsoft has confirmed this to be a problem in Microsoft Access 97.

Hope this helps.

db
~

~*~*~*~*~*~
All you need is a can of WD-40 and a roll of duct tape.
~*~*~*~*~*~
 
db,

Thanks, that's very useful info - I shall be putting it to good use immediately - sometime soon.

rod

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top