An error occured while converting Database

  • Hey there.

    I'm converting Access data base to work on sql 2005 server and i got an error '438' calling Object doesn't support this property or method in line

    qdf.sql = strSQL in function

    Public Function ChangeQueryDef(strQuery As String, strSQL As String) As Boolean

    ' strSQL The SQL string for the querydef

    If strQuery = "" Or strSQL = "" Then Exit Function

    Dim qdf As Object 'QueryDef

    'Set qdf = CurrentDb.QueryDefs(strQuery)

    Set qdf = CurrentProject.Connection.Execute(strQuery)

    qdf.sql = strSQL

    qdf.Close

    'RefreshDatabaseWindow

    ChangeQueryDef = True

    End Function

    It was working before.... Could anyone tell me what am i doing wrong?

    Thanks in advice.

  • Public Function ChangeQueryDef(strQuery As String, strSQL As String) As Boolean

    ' strSQL The SQL string for the querydef

    If strQuery = "" Or strSQL = "" Then Exit Function

    Dim qdf As Object 'QueryDef

    'Set qdf = CurrentDb.QueryDefs(strQuery)

    Set qdf = CurrentProject.Connection.Execute(strQuery)

    qdf.sql = strSQL

    qdf.Close

    'RefreshDatabaseWindow

    ChangeQueryDef = True

    End Function

    Make sure the Activex for Calling the CurrentProject is checked

    on Access. if you are using a Query that is passthrou then make sure the ODBC connection is correct. if you are using the store procedures in SQL2005 then rewrite the function.

    "We never plan to Fail, We just fail to plan":)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply