Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 19th, 2004, 01:27 PM
Authorized User
 
Join Date: Feb 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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--





Similar Threads
Thread Thread Starter Forum Replies Last Post
If condition doesn't work else part Please help me kumar3_99 SQL Server 2000 3 August 14th, 2007 09:27 AM
Getting Part of a String needelp Access VBA 4 September 19th, 2006 06:22 AM
Recordset empty when opening querydef DeAnzaJig Access VBA 3 November 14th, 2005 09:31 AM
querydef emady Access 1 June 2nd, 2005 10:58 AM
QueryDef and/or Recordset? bhunter Access 3 February 18th, 2004 04:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.