Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Jan 2003
    Location
    Manchester, Lancashire, England
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Variable Append Query (2003)

    I expect that this is easy if you know what you

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

    Re: Variable Append Query (2003)

    If you create a parameter query, and declare the parameter explicitly in Query | Parameters..., you can use DAO to set the parameter in code. You need to set a reference to the Microsoft DAO 3.6 Object Library in Tools | Options... in the Visual Basic Editor. Code could look like the following, with the appropriate names substituted.

    Sub RunAppend(strNotes As String)
    Dim dbs As DAO.Database
    Dim qdf As DAO.QueryDef

    Set dbs = CurrentDb
    ' use name of your query for MyAppendQuery
    Set qdf = dbs.QueryDefs("MyAppendQuery")

    ' use name of your parameter for Enter NoteText
    qdf.Parameters("Enter NoteText") = strNotes
    qdf.Execute

    Set qdf = Nothing
    Set dbs = Nothing
    End Sub

    Sub AppendMultiple()
    ' call RunAppend as many times as needed
    RunAppend "Letter Sent"
    RunAppend "Letter Received"
    RunAppend "Letter Torn"
    RunAppend "Letter Eaten"
    End Sub

  3. #3
    Star Lounger
    Join Date
    Jan 2003
    Location
    Manchester, Lancashire, England
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Variable Append Query (2003)

    Thanks Hans. I've played with the code but lack the experience/knowledge to make it work.

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

    Re: Variable Append Query (2003)

    If you want to pursue this, please indicate where you get stuck, or where things go wrong. We will try to help you get it right.

  5. #5
    Star Lounger
    Join Date
    Jan 2003
    Location
    Manchester, Lancashire, England
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Variable Append Query (2003)

    Thanks for your help but I chickened out & did it with a clutch of individual append queries

Posting Permissions

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