If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Sub String Search using a Form
I have an ACESS table containg Columns ITEM NO and its DESCRIPTION. I want to
design a FORM where if I enter a word or sub string of a word in the Description field, I should get a report of all records satisfying the criteria. Please help me. I am a beginner in ACCESS. Thank you. |
#2
|
|||
|
|||
Sub String Search using a Form
Create the report laid out the way you want the results.
Add a text box to a form, and set its Name to (say) txtDescription. Add a command button, with these properties: Name cmdPrint On Click [Event Procedure] Click the Build button (...) beside the On Click property. Access opens the code window. Set up the code so it looks like this: Private Sub cmdPrint_Click() Dim strWhere As String strWhere = "[Description] Like *""" & Me.txtDescription & "*""" DoCmd.OpenReport "Report1", acViewPreview, , strWhere End Sub Some other examples of opening a report filtered to a key value: http://allenbrowne.com/casu-15.html or to a date range: http://allenbrowne.com/casu-08.html -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "RAGS" wrote in message news I have an ACESS table containg Columns ITEM NO and its DESCRIPTION. I want to design a FORM where if I enter a word or sub string of a word in the Description field, I should get a report of all records satisfying the criteria. Please help me. I am a beginner in ACCESS. Thank you. |
Thread Tools | |
Display Modes | |
|
|