Does anyone have some VB code for a form that will do a paramerter query? I want to create a form that when a text field is inputed a query is created that does a LIKE query to a table,
What are you going to use the query for? The reason I ask is that there are different ways to accomplish this but picking the right one for your situation requires more information.
I would like a simple text box for the e user to enter text. this test is going to be tied to the DESCRIPTION field. afterwards i was thinking clicking a buttion. the query results would be displayed inte form.
If the results will be shown using a form (which is a good thing, by the way) you can simply create your query to pull the fields you want and build your form for that. Then you can open your form by the click event of the button and you pass the WHERE CLAUSE (or in the code WhereCondition) which then will filter the data and display the data you want.
Code:
Dim strWhere As String
strWhere = "[PutFieldNameToFilterOnHere] Like '*" & Me.TextBoxNameHere & "*'"
DoCmd.OpenForm "FormNameHere", WhereCondition:=strWhere
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.