Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Query Question? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Did I see on this forum technique/code to query from a mdb to a table another mdb without linking the table? Hard coding the path, mdb, table, etc?

    Thanks, John

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Query Question? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    See for example <post:=609,558>post 609,558</post:>.

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Query Question? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    That is what I was looking for!

    I got this works OK
    <pre>SELECT eza_Preferences_Master.DataText,
    eza_Preferences_Master.Name,
    eza_Preferences_Master.strProfileCode
    FROM eza_Preferences_Master IN 'F:AppsAccess2kClerk.mdb'
    WHERE (((eza_Preferences_Master.Name)="System Expire Date")
    AND ((eza_Preferences_Master.strProfileCode)=getpref(" Profile Code")));
    </pre>



    Now I

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Query Question? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    You can't use a VBA function to retrieve the file name in a query. It *must* be a fixed, hard-coded name.

    You can, however, use VBA to change this name. The following requires a reference to the Microsoft DAO 3.6 Object Library.
    <code>
    Dim dbs As DAO.Database
    Dim qdf As DAO.QueryDef
    Dim strSQL As String

    Set dbs = CurrentDb
    Set qdf = dbs.QueryDefs("NameOfYourQuery")
    strSQL = "SELECT DataText, Name, strProfileCode FROM eza_Preferences_Master IN " & _
    GetPref("Path and Name of Frontend MDB Master_NBS") & _
    " WHERE Name='System Expire Date' AND strProfileCode=GetPref('Profile Code')"
    qdf.SQL = strSQL

    Set qdf = Nothing
    Set dbs = Nothing
    </code>
    You'd have to run this code before using the query.

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Query Question? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Perfect!

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •