Results 1 to 2 of 2

Thread: Adodc refresh failed

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    1

    Adodc refresh failed

    Hi i am new to ActiveX and i get the following errors (with adodc1.Refresh highlighted):

    syntax error in From Clause
    Method 'Refresh' of object 'IAdodc' failed.

    here's my code:

    Private Sub txtname_Change()

    adodc1.RecordSource = "Select * from tablecoy where coyname like '" & txtname.Text & "*'"
    adodc1.Refresh

    If txtname.Text = "" And txtcp.Text <> "" Then
    adodc1.RecordSource = "Select * from tablecoy where cperson like '" & txtcp.Text & "*'"
    adodc1.Refresh
    Exit Sub

    ElseIf txtname.Text <> "" And txtcp.Text <> "" Then
    adodc1.RecordSource = "Select * from tablecoy where coyname like '" & txtname.Text & "*' and cperson like '" & txtcp.Text & "*'"
    adodc1.Refresh
    Exit Sub

    ElseIf txtname.Text = "" And txtcp.Text = "" Then
    adodc1.RecordSource = "Select * from tablecoy"
    adodc1.Refresh
    Exit Sub
    End If

    End Sub

    what's wrong with my codes? pls help... thank you so much...

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Re: Adodc refresh failed

    Hi cheril0721, and welcome to the forums

    Does this happen on every line which has a where clause by any chance, or upon every one of those refreshes including the simple select * from?

    Are you using Access as your database source? (I'm wondering whether you need to use a % symbol rather than a * symbol in my asking this part).

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

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