-
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...
-
Re: Adodc refresh failed
Hi cheril0721, and welcome to the forums :wave:
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).