|
-
Mar 24th, 2008, 04:47 AM
#1
Thread Starter
New Member
Missing Operator
hello!!! newbie here....i also have this problem. my code goes like this...
vb Code:
Private Sub cmdSearch_Click()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\contact.mdb;Persist Security Info=False"
Set rs = cn.Execute("SELECT * FROM Table1 WHERE Contact ID = '" & txtContId.Text & "'")
DataGrid1.DataSource = rs
DataGrid1.Refresh
End Sub
what i want for this code is to search for a particular record that will be inputted in the txtContId.text and then show the other contents of that record in a table form in the datagrid1.
but instead in gives an error "operator missing".
Please help me....God bless
-
Mar 24th, 2008, 05:28 AM
#2
Re: Syntax error (missing operator)
You should create a New Thread for your question.
Field name Contact ID contains a space, you have to surround it with square brackets:
Code:
"SELECT * FROM Table1 WHERE [Contact ID] = '" & txtContId.Text & "'"
-
Mar 24th, 2008, 05:37 AM
#3
Re: Syntax error (missing operator)
 Originally Posted by anhn
You should create a New Thread for your question.
Agree.
Split into its own thread
If you wish to contribute to the answer to someone else's question, then by all means, post in their thread.
If, however, you have a question of your own, please create your own thread.
Thanks.
-
Mar 24th, 2008, 10:46 PM
#4
Thread Starter
New Member
Re: Missing Operator
Hi!
I am very sorry if I did not follow the rules of the forum. its just that I was in a hurry and thought that my question will fit to the other thread since i am experiencing the same error in my program.
thanx to anhn for replying to my question. I tried your suggestion and it genarated another error. It prompts "Data Member Not Found" and it's pointing to the "DataGrid1.DataSource = rs" statement in my above code.
Hope you can give me another suggestion or anybody in this forum. and I also hope I am posting the right question in the right thread right now.
Thanks again...God bless!
-
Mar 25th, 2008, 12:08 AM
#5
Member
Re: Missing Operator
HEy Tagheuer34,
try to add this line:
cn.cursorlocation = adUseClient
before this line:
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\contact.mdb;Persist Security Info=False"
-
Mar 25th, 2008, 12:45 AM
#6
Thread Starter
New Member
Re: Missing Operator
thank you Krizaaa for giving me a suggestion with regards to my problem.
But I already tried your suggestion and still it gave the same result.
But thanks anyway!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|