| | |
Alter Recordset by Text Box text.
![]() |
•
•
Join Date: Apr 2006
Posts: 7
Reputation:
Solved Threads: 0
I get the result I want in a Datagrid by using Recordset Sql:
Select * from MYQUERY Where (name Like 'WHATEVER*')
I change the name by retyping the whole line, substituting the new name,
typed into a long textBox named txt.Select, like this
Private Sub cmdSelect_Click()
Data1.RecordSource = txtSelect.Text
Data1.Refresh
End Sub
When try to use Select * From MYQuery Where ('name Like ' *')
and leave it in the TextBox, putting the next name in the space, nothing happens.
I want to put the names only in the textbox without retyping the whole line of sql to bring up the fields in my query.
Any offers of a few lines of helpful code would be much appreciated.
Bogeybrown
Select * from MYQUERY Where (name Like 'WHATEVER*')
I change the name by retyping the whole line, substituting the new name,
typed into a long textBox named txt.Select, like this
Private Sub cmdSelect_Click()
Data1.RecordSource = txtSelect.Text
Data1.Refresh
End Sub
When try to use Select * From MYQuery Where ('name Like ' *')
and leave it in the TextBox, putting the next name in the space, nothing happens.
I want to put the names only in the textbox without retyping the whole line of sql to bring up the fields in my query.
Any offers of a few lines of helpful code would be much appreciated.
Bogeybrown
•
•
Join Date: Apr 2006
Posts: 7
Reputation:
Solved Threads: 0
•
•
•
•
Hi,
Just type the name in TextBox.
and alter the code like this :
Dim TStr as String
TStr = "Select * from MYQUERY Where name Like '*" _
& txtSelect.Text & "*'"
Data1.RecordSource = TStr
Data1.Refresh
Regards
Veena
Veena,
Many thanks.
With the addition of a pair of brackets, one before name and the second before the last pair of quote marks, it worked like a charm.
Yours,
Bogeybrown.
![]() |
Similar Threads
- pass the value to the text box (JavaScript / DHTML / AJAX)
- Text box question (C#)
- Text box population from DBgrid. HELP!! (Visual Basic 4 / 5 / 6)
- text is being written in text box (Web Browsers)
- Help with text box height (HTML and CSS)
- Cannot enter any text in a IE text-box (Viruses, Spyware and other Nasties)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: difficulty creating a formula with a macro
- Next Thread: how I can know the updates of dllfiles?
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





