Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2005
    Posts
    13

    Question Unanswered: type mismatched current connection

    Hi,

    i want to exectue a updatequery when pressing a button.
    I know prettymuch the code (I read it in a book), but i keep getting stuck.

    i make a dimm cnn as connection
    then i say:

    cnn = currentproject.connection
    cnn.Execute "Update Company.CompanyVisible FROM Company Where (([Company].[CompanyCode]) like [Forms]![CompanyView]![CompanyView]) SET Company.CompanyVisible = Yes; "

    But i get the error type mismatched with cnn = currentproject.connection. i dont know what ive done wrong since i got it out of a book. Help is very much appriciated.

    Joost

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    You do not need to create a local ADO connection variable to use the intrinsic ADO connection within Access ...

    Try:
    Dim SQLString as string

    SQLString="UPDATE Company SET Company.CompanyVisible = Yes WHERE (([Company].[CompanyCode]) like " & [Forms]![CompanyView]![CompanyView] & "); "

    Currentproject.connection.execute SQLString,,AdCmdText

    And BTW, your SQL is all screwed up ...
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

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