Export table fields !

achalrikhi

New Member
Joined
Nov 20, 2013
Messages
38
Hello Friends,

I had an issue for exporting access table data to a text file format but I found a simple solution now. Like this :

DoCmd.TransferText acExportDelim, "exportdata", "Data", "C:\Users\welcome\Desktop\output.txt", True

this is working very fine. Only issue is that I do not want certain columns from the table and I don't know how to use select statement and where ? for eg.

I want a query like this :

Select Field 1, Field 3, Filed 4 from < TABLE NAME > where SERIES ( Table field ) = "EQ"

Please advice that how and where to put this query to export data along with Do.Cmd statement.


Regards

Achal
 
OK. First let's talk a little bit about when to ask a new question in an existing thread, and when to post a new question.

Even though it is all one project, if you have a new question that isn't entirely dependent upon a previous answer, it is best to post it as a new question. Why? Because then it appears as a new unanswered question, and many more people will look at it, and you increase your chances of getting a quick response. If they are not already involved in the thread, most people will not bother looking at a question that already has 20 replies to see if there are any new questions asked in it.

So the general rule of thumb is this:
- If you have a new question that is not dependent upon a previous response, post it as a new question in a new thread.
- If you have a follow-up question (or clarification of a response), post it in a new thread.

All three of your new questions are really new questions, and not so much dependent on earlier responses. So in the future, you will probably want to post those as new threads. I will try to address them here in this thread.

1. Regarding:
“ Do you want to delete all the records ? “ Yes / No.
Place this line before the delete line:
Code:
DoCmd.SetWarnings False
and then put this line just below the delete line:
Code:
DoCmd.SetWarnings True

2. Regarding your Dates question, you can use an Aggregate Query to get the earliest date, and then create a query using that date to pull the records you want.

To create this Aggregate Query, simply create a query only adding in the date field, and nothing else. Then click on the "Totals" button in the Query Builder (looks like a Sigma). This will add a Totals row with the words "Group By" under the date field name. Change "Group By" to "Min". This will return a one-record one-field query result with your minimum (earliest) date.

Now, create a new query joining your original table to this Aggregate Query on this date field. Then it will just return the records from the earliest date.

3. Regarding your file naming, please post the VBA code that you have that imports the CSV file. From there, we should be able to capture and manipulate the file name to use as a SaveAs file name.
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Dear Joe,

First of all I thank you for all your guidance and help. And yes I made a mistake and henceforth I will take proper care about the posting questions. I will take care of the rules as well. I am just going through your suggestions and apply that in my project. It was a great learning experience and an opportunity to have a conversation with a great person like you. With your suggestions, I hope I will be able to solve the problems I just asked in previous post.

In case I face any problem I will ask it as a new thread, as it will be all together a new question with no previous reference.

let me thank you once again for everything

Regards

Achal
 
Upvote 0
You are welcome Achal. Glad to help.

Don't worry. You haven't run afoul of any rules. Those things I mentioned are more just guidelines to help increase your chances of getting responses, especially if you asked something I didn't know, or if I was unavailable.
 
Upvote 0
You are welcome Achal. Glad to help.

Don't worry. You haven't run afoul of any rules. Those things I mentioned are more just guidelines to help increase your chances of getting responses, especially if you asked something I didn't know, or if I was unavailable.


Dear Joe,

As we have discussed, I am following the rule. I asked and replied in other thread also. Since you have taken lot of efforts and pain to share the knowledge and I have benefited from it. I had two files to convert. One I could completely solved the issue, ( credit goes to you ) the other one was still a problem about the sorting and filtering the current month's date.

I found a little easier way and it worked for me so I thought I must share it as I have learnt so much only because others have shared their knowledge. I have place a text box on the form, named txtexpdate and I have put this in query ( Design mode ), in criteria :

Like "*" & [Forms]![Futures]![txtexpdate] & "*"

I hope this might help someone with the same problems.

Thanks once again

Regards

Achal
 
Upvote 0

Forum statistics

Threads
1,221,860
Messages
6,162,479
Members
451,769
Latest member
adyapratama

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