save file dialog box with DoCmd Transfer Text Error :

achalrikhi

New Member
Joined
Nov 20, 2013
Messages
38
Dear friends,

I have a form with a table. I actually import the CSV file in to the table and then convert it to the text file.

Importing file with open dialog box is done perfectly. But while exporting it with a save dialog box, the error appears like :

Run-time error '3027' :

Can not update. Database or object is read only.

Can anyone help to resolve this issue ? Here is the code I am using :

Private Sub Command28_Click()


Dim intChoice As Integer
Dim strPath As String


'make the file dialog visible to the user
intChoice = Application.FileDialog(msoFileDialogSaveAs).Show
'determine what choice the user made


If intChoice <> 0 Then
'get the file path selected by the user
strPath = _
Application.FileDialog(msoFileDialogSaveAs).SelectedItems(1)
'displays the result in a message box
Call MsgBox(strPath, vbInformation, "Save Path")


DoCmd.TransferText acExportDelim, "fo Export Specification", "Fo", strPath, True
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE * FROM TblFutures;"
DoCmd.SetWarnings True
End If


End Sub

Please guide and suggest a solution.

Thanks & Regards

Achal
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Sometimes you can get Fake Error messages. What really happens is the Export Spec does not match the data. I got it many times,and the error is no help.
Review your export spec, and the query you are are exporting...make sure they both match.

and that the FULL export path is valid.
 
Upvote 0
Sometimes you can get Fake Error messages. What really happens is the Export Spec does not match the data. I got it many times,and the error is no help.
Review your export spec, and the query you are are exporting...make sure they both match.

and that the FULL export path is valid.


If it is a fake error message then why this code works perfectly fine if I give a full physical path in DoCmd.TransferText statement ? The problem arises only when I give "strpath" after defining it.

Regards

Achal
 
Upvote 0

Forum statistics

Threads
1,215,032
Messages
6,122,772
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top