|
-
Jan 9th, 2000, 05:44 AM
#1
Thread Starter
Addicted Member
I have a Few more DB Questions if someone would kind enough to answer them
If I put "Cheese" in a text box, and I want it to go find the word cheese In a field and bring up the whole record; how could I do that??
How Can I state which record to move to??
-
Jan 9th, 2000, 06:05 AM
#2
Hyperactive Member
Hi,Dayo321.
There is a code, but you have to keep in mind, that text in Text box should be the same as in database field :
Private Sub Command2_Click()
Dim sql As String
sql = "select * from categories where description = " & Chr(34) & Text1.Text & Chr(34)
Data1.RecordSource = sql
Data1.Refresh
End Sub
If you're not sure of the text, you should use another sql:
sql = "select * from categories where description like " & Chr(34) & Text1.Text & Chr(42) & Chr(34)
Chr(34) is ""
Chr(42) is *
Larisa
-
Jan 9th, 2000, 06:07 AM
#3
Hyperactive Member
Sorry, I misspelled you name.
Larisa
-
Jan 9th, 2000, 08:57 AM
#4
Thread Starter
Addicted Member
Thanks, Your real knowledgable.
My name is Evan
-
Jan 9th, 2000, 09:35 AM
#5
Thread Starter
Addicted Member
Grr..
Another error.
Umm.. Ok I Wrote ..
SQL = "select * from categories where description like " & Chr(34) & Text1.Text & Chr(42) & Chr(34)
Data1.RecordSource = SQL
Data1.Refresh
And It said
"The Microsoft jet engine cannot find input table or query. Make sure it exists and the name spelled correct."
The Dbsourse is called "General"
Whats wrong??
-
Jan 10th, 2000, 07:25 AM
#6
Hyperactive Member
Hi, Evan.
To work with database you have to know sql.Here is link to sql tutorial: http://w3.one.net/~jhoffman/sqltut.htm
I gave you example that will work with Northwind database. But if you are working with another db, you have to put in select statement your table name and field name.
In my sample * means that I select all fields from table Categories.
So table name is Categories.
And field name is Description
So you have to check your database, if table that you are using in select statement exists and you spelled it correctly. The same goes for field name.
I hope you understand my explanation. English is not my native language.
Larisa
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
|