Donald Whittemore
asked on
Access 2010 selective export
Access 2010
I found code to do what I want but it does not work. The code is:
It goes fine until the Set qry statement. Then I get a Run-time 3265 Item not found in this collection
Where is qryTemp defined?
In the DoCmd where is qry.Name defined?
I found code to do what I want but it does not work. The code is:
[embed=snippet 8267437]Dim nLowKey As Integer
Dim nHighKey As Integer
Dim sKey As String
nLowKey = txtLowKey
nHighKey = txtHighKey
sKey = "HOLDER"
Dim qry As QueryDef
Dim sqlStmt As String
sqlStmt = "SELECT * FROM CARDS WHERE (" & sKey & " = " & nLowKey & ") OR (" & sKey & " = " & nHighKey & ");"
Set qry = CurrentDb().QueryDefs("qryTemp")
qry.SQL = sqlStmt
DoCmd.TransferText acExportDelim, "ExportCards", qry.Name, "D:\IBMCollection\Cards.csv"
It goes fine until the Set qry statement. Then I get a Run-time 3265 Item not found in this collection
Where is qryTemp defined?
In the DoCmd where is qry.Name defined?
Dim nLowKey As Integer
Dim nHighKey As Integer
Dim sKey As String
nLowKey = txtLowKey
nHighKey = txtHighKey
sKey = "HOLDER"
Dim qry As QueryDef
Dim sqlStmt As String
sqlStmt = "SELECT * FROM CARDS WHERE (" & sKey & " = " & nLowKey & ") OR (" & sKey & " = " & nHighKey & ");"
Set qry = CurrentDb().QueryDefs("qryTemp")
qry.SQL = sqlStmt
DoCmd.TransferText acExportDelim, "ExportCards", qry.Name, "D:\IBMCollection\Cards.csv"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER