Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating excel files

Status
Not open for further replies.

commanderrico

Technical User
Jul 21, 2003
23
0
0
US
I posted a message yesterday about date sensitive materials and my computer was having issues so I couldn't attach the file for you to look at. Anyway, someone from another forum suggested that I have individuals input data in access and then press a command button which would create an Excel file that has all the information in it. How can I do this and how can I format the Excel file automatically so that it meets the needs of the user? Thanks in advance.

Rico
P.S. If you need more info just let me know.
 
Rico
1)Create a query to capture the data you want to pass to Excel

2) use the following within your command button code
DoCmd.OutputTo acQuery, "qryName", "MicrosoftExcel(*.xls)", "Output Path and FileName.xls", , ""

Hope this helps

PassingBy
 
The thing is that the user needs to create a new Excel file everyday. Is there a way to program the button and the form so that they can enter what they want the file name to be? I'm kinda new at all this programming stuff so if you would give me a little more direction that would be great. Thanks a ton.

Rico
 
Rico
If you leave the Output path and File name blank the user will be prompted for a file name and location to save a new file.

Revised line on your command button
DoCmd.OutputTo acQuery, "qryName", "MicrosoftExcel(*.xls)", , , ""


PassingBy

 
Ok, I got the command button down. How do I go about creating the query so that I can capture exactly what I need? This is really helping, thanks so much.

rico
 
Rico
I had presumed you would be familier with creating the query.

Not wishing to sound demeaning or insulting but I suggest you do some playing around or readup about creating queries prior to learning code.

PassingBy
 
I do know how to create a query, and I do know some code, what I was asking, in a round-about way was if there was anything special I would need to do in the query in order to get the results I want. Maybe something I wasn't aware of.
 
Ricco
No, you do not need to do anything special to your query just as long as it is providing you with the data you want in your spreadsheet.

PassingBy (back from lunch)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top