export subform data to a text box or to a file

T

Tiago

Hello All

I have here a problem that is:

I have a form called frmGames with a combo box called cmbGameType, so when i
change the value of my cmbGameType, a sub form called subfrmGames, based in a
query(qryGames) shows the correct data.

My question is, how to do a command button to export this data on my subform
to a textfile or to a text box?

Thanks
 
O

Ofer Cohen

Use the TransferText command line, check help about the options you can have

docmd.TransferText acExportDelim,,"QueryName","c:\FileName.txt"
 
T

Tiago

Hello Mr Ofer Cohen,

the tranfertext worked, but export all records that i have in the query, i
just want to export the record that are filtered in my form... is it possible
do to that?
 
O

Ofer Cohen

How did you filter your query?

You can create reference in the query to the combo in the form

Select * From TableName Where FieldName = Forms![frmGames]![cmbGameType]

On the after update event of the combo run the code

Me.[enter here the Sub Form control name].Requery
 
T

Tiago

Thanks for your prompt answer,

But still don't work....

Imagine that, in the combo box i chose the game type "Action", so the
subform with the list of the games, display the correct games, sorted by
pontuation(pontuation filed is not on my query). Who could i export?

I just want the list that is displayed on my subform(based on that query and
on that filter), and not all data in my query

Thanks again

Ofer Cohen said:
How did you filter your query?

You can create reference in the query to the combo in the form

Select * From TableName Where FieldName = Forms![frmGames]![cmbGameType]

On the after update event of the combo run the code

Me.[enter here the Sub Form control name].Requery

--
Good Luck
BS"D


Tiago said:
Hello Mr Ofer Cohen,

the tranfertext worked, but export all records that i have in the query, i
just want to export the record that are filtered in my form... is it possible
do to that?
 
Top