export filter data in selected fields to excel (1 Viewer)

Jibbadiah

James
Local time
Tomorrow, 08:01
Joined
May 19, 2005
Messages
282
Try this...

Create a second query as specified above...

Insert a command button on your form.

Make this command button run a macro with the following details:
Action: TransferSpreadsheet
Transfer Type: Export
Spreadsheet Type: MS Excel
Table Name: <Input the name of your new query mentioned above>
FileName: <Input name of file you want it to go to>

When someone makes a selection on the form, the macro will use that selection in the 2nd query. the results of the 2nd query will then be output to the excel spreadsheet.

Is this what you were after?
 

Jibbadiah

James
Local time
Tomorrow, 08:01
Joined
May 19, 2005
Messages
282
... By the way...

"Correct. Although I have to edit the value manually when I open the query"

You shouldn't have to enter the criteria manually, provided the form is still open and has one of your records selected. In this instance I am assuming that you have named your form control by the same name as the field, i.e. surname. You can see this by clicking the control in design view and viewing the name under the properties, other tab.
 

Accesspaz

Registered User.
Local time
Today, 15:01
Joined
May 20, 2005
Messages
12
No go

It doesn't pass on the filter, so all records are shown.
Although you can select the fields

I tryed this one before an besides the above result. One main point why this wouldn't be the best solution (if it worked, o.k. maybe ;) ) and that is that a specified path and file naam has to be given. With the Output to the user can specify the name and folder of the document.

Microsoft logic.
 

Jibbadiah

James
Local time
Tomorrow, 08:01
Joined
May 19, 2005
Messages
282
Do you want to send the database to me and I will do it quickly for you... and then you will see the explanation.

J
 

Accesspaz

Registered User.
Local time
Today, 15:01
Joined
May 20, 2005
Messages
12
Thanks for the offer J

Sorry can't do

o.k thanx for your time, I'll keep looking then.

Happy programming!! :)
 

Jibbadiah

James
Local time
Tomorrow, 08:01
Joined
May 19, 2005
Messages
282
Don't want to give up... but thinking it is about time.

You can get the user to specify the filename on the same form. This can be used in an event procedure. Name the form control as "filename", and then the following procedure will work. A command button can run this procedure.

Function AccessPAZ()

Dim filename As String
Dim Frm As Form

filename = Forms![<Insert_Form_Name_Here>]![<Insert_Field_Name_Here>]

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "<Insert_the_Name_of_your_2nd_Query_Here", filename

End Function
 

Kavithathanikanti

New member
Local time
Tomorrow, 03:31
Joined
May 20, 2022
Messages
2
Try this...

Create a second query as specified above...

Insert a command button on your form.

Make this command button run a macro with the following details:
Action: TransferSpreadsheet
Transfer Type: Export
Spreadsheet Type: MS Excel
Table Name: <Input the name of your new query mentioned above>
FileName: <Input name of file you want it to go to>

When someone makes a selection on the form, the macro will use that selection in the 2nd query. the results of the 2nd query will then be output to the excel spreadsheet.

Is this what you were after?
Hey hii this is my exact problem right now could you please help me in this
 

Kavithathanikanti

New member
Local time
Tomorrow, 03:31
Joined
May 20, 2022
Messages
2
First off I apoligise if this is a clear answer. I have looked on the internet for the last two days and can't seem to find this anywhere, either that or I am just entereing the search parameters in wrong :confused:

I have filtered selection in a form which I want to export to excel.

Simple enough ;) : Created a macro with the export to command. This dus everything I want to do.

Well not quite. :rolleyes:

How do I select the fields I want to export.Something like Select Id, name, adres from query soandso

Hopefully there is a simple solution to this. If there any existing posts. Could you post the link for me.

Thank your for your time,
Kind regards,
Same issue with me.........
 

Minty

AWF VIP
Local time
Today, 23:01
Joined
Jul 26, 2013
Messages
10,368
@Kavithathanikanti - You do realise this is a 17 year old thread?
1653038077243.png
 

Users who are viewing this thread

Top Bottom