|
-
Jul 18th, 2000, 01:24 AM
#1
Thread Starter
Addicted Member
Yeah i have a problem.
I have 7 textboxes and i want to be able to search all of the text boxes at once and then display the results on a Datagrid. How do i do this?
Reality is an illusion caused by by lack of drugs
Is this real or am i just having a dream?
-
Jul 18th, 2000, 01:38 AM
#2
Hyperactive Member
1. Add a textbox to a form
2. Copy It
3. Paste it and say "Yes" to create a "Control Array"
4. Do this as many times as you like
To construct the query :
Code:
Dim i as Integer
sSql = "SELECT * FROM SearchTable WHERE " <-- Notice the space
sWhere = ""
For i = 0 to TextBox1.Count - 1
If Trim(TextBox1(i).Text) <> "" Then
If sWhere <> "" Then
sWhere = sWhere & "AND "
End If
sWhere = sWhere & "SearchField like '%" & TextBox1(i).Text & "%' " <- Another space at the end
End If
Next i
rstResults.OpenRecordset sSql & sWhere, adoConnection, adOpenStatic, adOpenReadONly, adCmdText
' Clear the DataGrid
Do While not rstResults.Eof
' Add a new item to the datagrid
rstResults.MoveNext
Loop
rstResults.Close
set rstResults = nothing
I am not going to go through how to add it to the grid, that should be the easy part.
-
Jul 18th, 2000, 01:50 AM
#3
Thread Starter
Addicted Member
Ok i did that but when it runs it says that an object is required and highlights the line "rstResults.OpenRecordset sSql & sWhere, adoConnection, adOpenStatic, adOpenReadONly, adCmdText"
Would this be because i have to set this line to the recordsource of the adodc?
Reality is an illusion caused by by lack of drugs
Is this real or am i just having a dream?
-
Jul 18th, 2000, 03:10 AM
#4
Thread Starter
Addicted Member
Hey could anybody help me....
The line;
rstResults.OpenRecordset sSql & sWhere, adoConnection, adOpenStatic, adOpenReadONly, adCmdText <- Error object required.
Do i have to set this to the ADODC or the MSHFlexGrid?
Reality is an illusion caused by by lack of drugs
Is this real or am i just having a dream?
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
|