Runawaygeek
Registered User.
- Local time
- Today, 17:01
- Joined
- Mar 28, 2016
- Messages
- 77
Hi all,
This is my code:
So the file outputs fine, with the exception of the filter not working.
DoCmd.ApplyFilter , "[Aff_ID] = IDBX"
[Aff_ID] = the Column on the Query that contains the ID
IDBX = The Box on the form that contains the ID
The form only shows one client record at a time, the table shows the history of details associated with that Client.
My code, exports the entire Query.
Apart from the odd code layout, what have i got wrong?
Thanks,
Ben
This is my code:
Code:
Private Sub Command10_Click()
Dim Path As String
Dim Af As String
Dim AL As String
Dim DT As String
Path = "C:\"
Af = Affiliatebx 'A box on the form that give the client name
XL = ".xls"
DT = Format(Now, "DDMMYYYY")
DoCmd.Close 'this is here as the Readonly, does not seem to be working
DoCmd.OpenQuery "ImplementationAndDevelopment_Output", acViewNormal, acReadOnly
DoCmd.ApplyFilter , "[Aff_ID] = IDBX"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "ImplementationAndDevelopment_Output", Path & Af & "_" & DT & XL, True
DoCmd.Close
DoCmd.OpenForm "Implementation_And_Development", acNormal
Shell "C:\Windows\explorer.exe """ & Path & "", vbNormalFocus
End Sub
So the file outputs fine, with the exception of the filter not working.
DoCmd.ApplyFilter , "[Aff_ID] = IDBX"
[Aff_ID] = the Column on the Query that contains the ID
IDBX = The Box on the form that contains the ID
The form only shows one client record at a time, the table shows the history of details associated with that Client.
My code, exports the entire Query.
Apart from the odd code layout, what have i got wrong?
Thanks,
Ben