Passing value from inputbox to query

  • Thread starter Thread starter gb
  • Start date Start date
G

gb

Hello

I have a database that I designed which has been running 'as is' for nearly
2 years (in a work environment). A new member of staff asked if I could
incorporate into it a search facility, which I am looking at building on.

In short, the main form has a subform (connected to a table called Contacts)
that lists all the contacts for the company (the subform only shows selected
fields). Each contact can be opened on a separate form which shows all
available fields. In turn, this form also has a subform, which is connected
to a separate table called Enquiries. This is used for capturing any notes
for this contact, the user and the date.

The request is to have a search facility for the said notes section, by
means of searching on a 'like' term. So, if the notes for a particular
record show 'Hello this is a test' and the user entered 'test' as the search
criteria, the record with 'Hello this is a test' should be returned.

Anyway, the idea I have is to run this facility by adding a button to the
main form, which, when clicked, will show an inputbox. When the user clicks
OK, the entered value is passed to a query, and the returned contact records
(ie, from the Contacts table as it does already, not the notes) appear in
the existing subform on the main form.

Unfortunately, I don't know how to get values from an input box to be passed
to a query for this to work. Can anyone help? Indeed, is my idea
plausible, and if so, am I looking at this idea in the right way?

Thank you for your help.

gb
 
Rather than that, add a parameter to your query. If you put Like "*" &
[Lookup term] & "*" as the criteria under the Notes field, Access will issue
the equivalent of a InputBox when you run the query.
 
Back
Top