How do I get the QueryDef part to work
One more thing Joe,
I need to append these records to tblB via recordset by flight number; with the D* RunNo first for each group of flights then the A*
Then the next group. I am sorting test results for each flight....
Sub sResetFTP()
Dim rstFTPNumbers As Recordset
Dim defFTPNumber As QueryDef
Dim sSql As String
Dim strcut As String
Dim strFlight As String
strcut = "appFTPD-TableB"
(your suggestion)
Where do I use it or how
'"SELECT tblFTP.RecordNo, tblFTP.[Flight No], tblFTP.[Run No], tblFTP.[Emitter/WRPR No]tblFTP.[TIS No], tblFTP.Site, tblFTP.[Date Flown], From tblFTP where (((rstFTPNumbers![Flight No]=?) And (tblFTP.[Run No]) Like D*)OR (tblFTP.[Run No]) Like A*)ORDER BY tblFTP.RecordNo, tblFTP.[Flight No], tblFTP.[Run No], tblFTP.[Emitter/WRPR No], tblFTP.[TIS No];" Dim db As Object
Set db = CurrentDb()
Set rstFTPNumbers = db.OpenRecordset("SELECT DISTINCT tblFTP.[Flight No]From tblFTP ORDER BY tblFTP.[Flight No];")
Set defFTPNumber = db.QueryDefs(strcut)
rstFTPNumbers.MoveFirst
Do Until rstFTPNumbers.EOF
strFlight = rstFTPNumbers![Flight No]
'DoCmd.OpenQuery "appFTPD-TableB"
(My append code)
'sSql = "INSERT INTO tblB ( RecordNo, [Flight No], [Run No], [Emitter/WRPR No], [TIS No], Site, [Date Flown], SELECT tblFTP.RecordNo, tblFTP.[Flight No], tblFTP.[Run No], tblFTP.[Emitter/WRPR No]tblFTP.[TIS No], tblFTP.Site, tblFTP.[Date Flown], From tblFTP where (((rstFTPNumbers![Flight No]) And (tblFTP.[Run No]) Like D*)ORDER BY tblFTP.RecordNo, tblFTP.[Flight No], tblFTP.[Run No], tblFTP.[Emitter/WRPR No], tblFTP.[TIS No];"
Beep
rstFTPNumbers.MoveNext
Loop
End Sub
__________________
In matters of style, swim with the current. In matters of principle, stand like a rock. Thomas Jefferson
-------\\\\\\|///
--------(oo)
--oOOo-(_)-oOOo--
|