Results 1 to 2 of 2

Thread: Running a query with parameters

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2008
    Posts
    12

    Running a query with parameters

    Hi All

    I'm trying to run a query using docmd.openQuery. The query I want to run accepts 1 parameter which is located in the current form this is open in and running from. I tried doing something like this
    Code:
    Private Sub Form_AfterUpdate()
        With DoCmd
         .SetWarnings False
         .OpenQuery (staffRecodUpdateTime [Form]![View Employee]!Text187.Value])
         .SetWarnings True
        End With
    End Sub
    but its not valid syntax. Any help would be gladly appreciated?

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Running a query with parameters

    use DAO or ADO (depending if you are running from Access or Excel/VB respectively).

    Stay away from docmd to open recordsets

    I think there are some sticky threads at the top of this forum that may assist you. Otherwise post back with some code.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

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



Click Here to Expand Forum to Full Width