What is the correct syntax?

kobekaren

Registered User.
Local time
Today, 14:02
Joined
Jun 26, 2008
Messages
16
i built this event....

Private Sub Command39_Click()
Dim x As String
x = "All Current PC and Server"
DoCmd.OutputTo acOutputQuery, "x", acFormatXLS, "All Current PC and Server.xls", True
End Sub

Of course , that is not correct.

can anyone tell me how can i correct this and compile it successfully?
 
Try with no quotes around the x.
 
Private Sub Command39_Click()
Dim x As String

I hope you are using meaningfull names for your controls! and Variables :eek:

This doesnt seem to be so... You really should use meaningfull names ! :cool:
 
Paul was 50% there. You need to take the quotes off the x but you also need the PATH with the file name:

DoCmd.OutputTo acOutputQuery, x, acFormatXLS, "C:\YourFolderName\All Current PC and Server.xls", True
 
Paul was 50% there.

While I would agree that the path should be specified, it is not required (in A2k anyway). If no path is specified, the file will go to the default location.
 

Users who are viewing this thread

Back
Top Bottom