none
change datatype in update query RRS feed

  • Question

  • Datatype mismatch...
    Code Snippet

    Dim conADO As ADODB.ConnectionClass = New ADODB.ConnectionClass
            Dim strSQL As String

            conADO.Open("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\baze\Synchro.accdb;Jet OLEDB:Database Password=prodajapass1;", Nothing, Nothing, 0)
            strSQL = "UPDATE Catania INNER JOIN CRM ON Catania.St_stranke = CRM.[Zunanji ID] SET Catania.www = CRM.URL"
            conADO.Execute(strSQL, 0, 0)
            conADO.Close()


    CRM.[Zunanji ID] = text, 10
    Catania.St_stranke = AutoNumber, Long Intiger

    solution in access is
    Code Snippet

    PDATE Catania INNER JOIN CRM ON Catania.St_stranke = val(CRM.[Zunanji ID]) SET Catania.www = CRM.URL



    what about VB and ADO?
    Friday, June 13, 2008 4:01 PM

Answers

All replies

  • The Val function is recognized by the Jet database engine so you should be able to use it in ADO as well.
    Friday, June 13, 2008 4:33 PM
  • this code
    Code Snippet

    Dim conADO As ADODB.ConnectionClass = New ADODB.ConnectionClass
            Dim strSQL As String

            conADO.Open("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\baze\Synchro.accdb;Jet OLEDB:Database Password=prodajapass1;", Nothing, Nothing, 0)
            strSQL = "UPDATE Catania INNER JOIN CRM ON Catania.St_stranke = CRM.[Zunanji ID] SET Catania.www = CRM.URL"

            conADO.Execute(strSQL, 0, 0)
            conADO.Close()

    returns: Type mismatch in expression.

    this code
    Code Snippet

         Dim conADO As ADODB.ConnectionClass = New ADODB.ConnectionClass
            Dim strSQL As String

            conADO.Open("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\baze\Synchro.accdb;Jet OLEDB:Database Password=prodajapass1;", Nothing, Nothing, 0)
            strSQL = "UPDATE Catania INNER JOIN CRM ON Catania.St_stranke = val(CRM.[Zunanji ID]) SET Catania.www = CRM.URL"

            conADO.Execute(strSQL, 0, 0)
            conADO.Close()

    returns: Data type mismatch in criteria expression.

    Catania is access97
    CRM is paradox 5.x

    catania.St_stranke : AutoNumber, Long Intiger
    CRM.Zunanji ID : text, 20

    Catania.www : text, 50
    CRM.URL : text, 50

    If go to paradox and change CRM.Zunanji ID to Long Intiger it is working (unfortunatly i can't use it like that, i have to convert it in query)
    Friday, June 13, 2008 5:56 PM
  • baah... somethimes i'm so stupid

    this is the solution: int(CRM.[Zunanji ID])
    Friday, June 13, 2008 6:05 PM