Queries and Input Boxes

I am creating an application for college were i have to create a simple front end for a simple access database.

I need help when creating queries. I have a data control on my page that access's the Customer Table in my database. I want to allow a input box to appear that allows the user to enter the search criteria that they want i.e. a surname.

i know you create queries like this

datCustomers.RecordSource = "Select [Customer Details].* From [Customer Details] where Surname...............

and the message box looks something like

Dim criteria As String
Dim msg As String

msg = "Please Enter the Surname to Search For below : "
criteria = InputBox(msg, "Enter Search Criteria")

but how do i get the input from the input box in to this sql statement that then searches for the criteria entered.



  • Hello Phil1981,

    Have look at the following Microsoft Access on-line help topic:

    Create a parameter query that prompts for criteria each time it's run
    It starts with:
    A parameter query displays one or more predefined dialog boxes that prompt you for the parameter value (criteria). You can also create a custom dialog box that prompts for the query's parameters.

    I would be glad to provide any more help you may need in this regard.

    with best compliments,

    Your Friend In Need.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion