CuriousGeorge
Registered User.
- Local time
- Today, 19:36
- Joined
- Feb 18, 2011
- Messages
- 131
Hello,
Im trying to get my export to work.
My problem is that the field name (that is displayed in the query) is chosen via a combo box so it changes from time to time.
I get compiling error when trying to run the code because i need to set the field name to something in my export spec. It works though when the name is the same in combo box as in the export spec.
How do i set the field name in the export spec if it changes when a new selection is made in the combo box?
Thanks
Im trying to get my export to work.
My problem is that the field name (that is displayed in the query) is chosen via a combo box so it changes from time to time.
I get compiling error when trying to run the code because i need to set the field name to something in my export spec. It works though when the name is the same in combo box as in the export spec.
How do i set the field name in the export spec if it changes when a new selection is made in the combo box?
Thanks
Code:
Private Sub cmdSearch_Click()
Dim qdf As DAO.QueryDef
Dim s As String
Dim specname As String
specname = "Export Specs"
s = "SELECT " & Me.ComboParameter & " FROM TableData WHERE (((ReturnDate([AbsTime]))>=[Forms]![frm]![ComboDate] AND ((ReturnDate([AbsTime]))<=[Forms]![frm]![ComboDateTo])) AND ((TableData.BananaField) LIKE [Forms]![frm]![ComboType]));"
Set qdf = CurrentDb.QueryDefs("qryAll")
qdf.Sql = s
'DoCmd.OpenQuery ("qryAll")
DoCmd.TransferText acExportFixed, specname, "qryAll", "C:\Users\SSS787\exjobb\Database\Readlog_update\exports\export.txt", True
End Sub