|
-
Dec 12th, 1999, 03:48 PM
#1
Thread Starter
New Member
I currently have a value in a text box tht I need to search for in a table, but i do not seem to be able to get the button on the form to take this value and search through the table i have created for the specific value. Any suggestion?
Cheers in advance
Andrew
-
Dec 12th, 1999, 04:16 PM
#2
Hyperactive Member
If your text box is text1 and the field name is a_number then open the database (eg table1) and do the following
table1.findfirst "a_number = " & text1.text
to test if it has found it use table1.nomatch which will be true if it does not find it.
Is this y9our answer???
[email protected]
-
Dec 12th, 1999, 04:19 PM
#3
Hyperactive Member
Here is an example I use to logon (put the text in the click event of the command button
dim logon_data as recordset
Set logon_data = bar_data.OpenRecordset "users", dbOpenDynaset)
findstring = "user_no = '" & Text1.Text & "'"
logon_data.FindFirst findstring
If logon_data.NoMatch Then
MsgBox ("User does not exist")
Text1.Text = ""
user.Text = ""
Else
OK TO DO SOMETHING
endif
-
Dec 13th, 1999, 10:21 AM
#4
Addicted Member
So txtText1 and cmdBtn and rsData
Your users enter a string to txtText1 and click cmdBtn to do a search for say name in rsData
Private cmdBtn.Clink....
'
' Test user entered something
'
If len(trim(txtText1)) > 0 then
rsData.FindFirst("Fieldname = '" & txtText1 & "'")
if rs.nomatch then
.
else
data found do whatever
end if
.
.
You can shorten this with the use of SQL to do a complete sweep of the recordset. If you want an example email me at [email protected]
Hope it helps
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
|