424 Object Required

adam.greer

Registered User.
Local time
Today, 07:53
Joined
Apr 27, 2006
Messages
43
Hi Guys

Getting the 424 error with this line of code

Private Sub Command33_Click()

DoCmd.TransferText acExportFixed, "StationaryTemplateExportSpecification", "qryStationaryTemplate", frmStationaryTemplate.UserPath, False, ""

End Sub

It's from a macro converted into VB. "frmStationaryTemplate.UserPath" is a value from the form that the button sits on. Do I need to declare it in some way? This is all the code on the button.

Thanks

Adam
 
Try this instead:
Code:
Private Sub Command33_Click()
Dim strPath as String
strPath = Forms!frmStationaryTemplate.UserPath
DoCmd.TransferText acExportFixed, "StationaryTemplateExportSpecification", "qryStationaryTemplate", strPath, False

End Sub

I think you were actually failing with the comma and double quotes after the False part. You don't need to add an argument after the False part and if you do it isn't finding anything because you defined it as an empty string. I did change it slightly to add the path to a variable to make the transfer text code shorter and easier to read.
 
Works perfectly, thanks very much.
 

Users who are viewing this thread

Back
Top Bottom