Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    May 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Parameter Action Query Fails (Access 2000)

    I am having trouble with a parameterized query in Access 2000. I don't understand why this VBA code fails with error "Data Type Conversion Error". I am passing a string like the query is expecting. The query appends records to a local table.

    Dim qryDef As DAO.QueryDef

    Set qryDef = CurrentDb.QueryDefs("qu_Append_tu_Events_DE")
    ' (0) is expecting a string
    qryDef.Parameters(0).Value = "MyParameterValue"
    qryDef.Execute "qu_Append_tu_Events_DE"
    qryDef.Close
    Set qryDef = Nothing

    Error occurs on qryDef.Execute "qu_Append_tu_Events_DE

    Can someone help?

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

    Re: Parameter Action Query Fails (Access 2000)

    Welcome to Woody's Lounge!

    For the QueryDef object, the Execute method has the following syntax:

    qryDef.Execute options

    You are specifying a query name; that would be valid for the Execute method of CurrentDb. You can omit the argument altogether:

    qryDef.Execute

    or specify that execution should be undone if an error occurs:

    qryDef.Execute dbFailOnError

Posting Permissions

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