UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> I Need Some Help With How To Solve This Issue Please, Access 2007    
 
   
Lateral
post Feb 8 2018, 01:40 AM
Post#1



Posts: 184
Joined: 29-November 13



Hi guys

I'm trying to figure out how to approach an issue I have exporting selected record from a table into CSV format.

I have a table called [Parts] that contains a number of fields such as:

[Name]
[PriceRetail]
[Wholesale]
[URL]
etc

I want to display some sort of form (pick list) that will enable me to select which records from the [Parts] table I want to include in the export.

I really only want to export 2 field, [Name] and [URL].

I'm struggling figuring out how to do this and any guidance in the right direction would be greatly appreciated.

Cheers
Greg



Go to the top of the page
 
BuzyG
post Feb 8 2018, 08:05 AM
Post#2



Posts: 365
Joined: 20-September 12
From: Cornwall UK


You could set up a sub form in datasheet view, with the columns filtered. Then, on the main form, use the OutputTo Command, from a button, to export the view on the subform to a .csv file.

Here is the code I use to export from a filtered subform to Excel.

CODE
Private Sub btnExportDataAnalysis_Click()
On Error GoTo btnExportDataAnalysis_Click_Err

  DoCmd.Close
  DoCmd.OpenForm "FrmRepairDataAnalysis", acNormal, "", "", , acNormal
  DoCmd.OutputTo acOutputForm, "sfmRepairDataAnalysis", "Excel97-Excel2003Workbook(*.xls)", "", True, "", 0, acExportQualityPrint

btnExportDataAnalysis_Click_Exit:
Exit Sub

btnExportDataAnalysis_Click_Err:
  MsgBox Error$
  Resume btnExportDataAnalysis_Click_Exit
End Sub


If you omit the ACformat part of the statement, then Access will prompt you for the output format.

CODE
DoCmd.OutputTo acOutputForm, "sfmRepairDataAnalysis", , "", True, "", 0, acExportQualityPrint


I just tried that and notice that Text is included, in the options, but not .csv specifically. So if you need .csv specifically, you might want to look at Transfertext, not a method I have used.

Hope that helps point you in the right direction.
This post has been edited by BuzyG: Feb 8 2018, 08:26 AM

--------------------
Live to Surf
Go to the top of the page
 
doctor9
post Feb 8 2018, 09:50 AM
Post#3


UtterAccess Editor
Posts: 18,324
Joined: 29-March 05
From: Wisconsin


Greg,

> I want to display some sort of form (pick list) that will enable me to select which records from the [Parts] table I want to include in the export.

Depending on how many records we're talking about, a multiselect listbox might be a good solution. But if you have a LOT of records to choose from, you might want to consider adding a Yes/No field to the table. Then, you can have the user use that field to select records for exporting.

Hope this helps,

Dennis

--------------------
(;,;) Li'l Cthulu says: Please talk about what you're trying to do, as well as how you're doing it.
Changing your real table name to "Table1" and your real form name to "Form1" in your posts makes it more difficult to understand what's going on, not easier.
Guidelines for Posting Questions
Go to the top of the page
 
Lateral
post Feb 8 2018, 02:03 PM
Post#4



Posts: 184
Joined: 29-November 13



Thanks guys

I'll have a play around with your ideas and let you know how I go..

Cheers
Greg
Go to the top of the page
 
Lateral
post Feb 9 2018, 02:53 PM
Post#5



Posts: 184
Joined: 29-November 13



Hi guys

I sorted it out by adding a new YES/NO field to the Parts table and then creating a query that extracted the data I needed and used that query in the DoCmd.TransferText...

DoCmd.TransferText acExportDelim, "Buffer Export Specification", "qFacebookToBuffer", "c:\RPR Access\web shop\buffer.csv", False

It all works really well.

Thanks again for your help

Cheers
Greg
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    18th June 2018 - 11:03 AM