A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Parameter Query



 
 
Thread Tools Display Modes
  #1  
Old February 6th, 2009, 10:35 PM posted to microsoft.public.access.gettingstarted
Srowe
external usenet poster
 
Posts: 34
Default Parameter Query

I have a query setup for the user to search for a person using the lastname
field. What I would like to do is narrow it down further by having the query
ask the user to input the lastname and then the first name. Thus bringing up
only the records matching that particular person.

Is this possible?

Scott
  #2  
Old February 7th, 2009, 12:46 AM posted to microsoft.public.access.gettingstarted
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Parameter Query

Scott

Possible, yes. Desirable, not much!

If you want your users to find a particular person, why are you forcing them
to remember the person's name, AND to spell (and punctuate) it properly?

If you create a form, add a combobox, and base that combobox on a query that
lists all available persons by LastName, FirstName, the users will be able
to PICK the one they want.

Regards

Jeff Boyce
Microsoft Office/Access MVP

"Srowe" wrote in message
...
I have a query setup for the user to search for a person using the lastname
field. What I would like to do is narrow it down further by having the
query
ask the user to input the lastname and then the first name. Thus bringing
up
only the records matching that particular person.

Is this possible?

Scott



  #3  
Old February 7th, 2009, 01:10 AM posted to microsoft.public.access.gettingstarted
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Parameter Query

On Fri, 6 Feb 2009 14:35:01 -0800, Srowe
wrote:

I have a query setup for the user to search for a person using the lastname
field. What I would like to do is narrow it down further by having the query
ask the user to input the lastname and then the first name. Thus bringing up
only the records matching that particular person.

Is this possible?

Scott


A "Parameter Query" is the technique you'ld use. Bear Jeff's good advice in
mind - selecting "Ravindranathan, Srinivasan" from a combo box is easier than
typing it! But you can use a paramter query with criteria such as

=[Enter last name:]

on the last name field, and also

=[Enter first name:]

on the first name field. Better would be to have an unbound Combo Box cboName
on a form (let's call it frmMyForm); this would have the unique personID as
its bound column, and you'ld use a criterion on the PersonID field of

=[Forms]![frmMyForm]![cboName]

If your names table doesn't have a unique person ID... it should. Names change
and they are not unique.

--

John W. Vinson [MVP]
  #4  
Old February 7th, 2009, 02:53 AM posted to microsoft.public.access.gettingstarted
Rich Wonneberger
external usenet poster
 
Posts: 20
Default Parameter Query

Jeff,

Can this work if the first and last names are separate fields?

If a table had the 2 fields, could a query have the combo box like that?

I work mostly in a query.

TIA
Rich W.


Jeff Boyce wrote:

If you create a form, add a combobox, and base that combobox on a query that
lists all available persons by LastName, FirstName, the users will be able
to PICK the one they want.

  #5  
Old February 7th, 2009, 04:37 AM posted to microsoft.public.access.gettingstarted
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Parameter Query

Open query in design view. Type this in the Criteria row of the grid under
field FirstName.
Like [Enter first name] & "*"

This allows the operator to enter complete name, forst part of name, or no
name by pressing the ENTER key.

--
KARL DEWEY
Build a little - Test a little


"Srowe" wrote:

I have a query setup for the user to search for a person using the lastname
field. What I would like to do is narrow it down further by having the query
ask the user to input the lastname and then the first name. Thus bringing up
only the records matching that particular person.

Is this possible?

Scott

  #6  
Old February 7th, 2009, 03:36 PM posted to microsoft.public.access.gettingstarted
Srowe
external usenet poster
 
Posts: 34
Default Parameter Query



"John W. Vinson" wrote:

On Fri, 6 Feb 2009 14:35:01 -0800, Srowe
wrote:

I have a query setup for the user to search for a person using the lastname
field. What I would like to do is narrow it down further by having the query
ask the user to input the lastname and then the first name. Thus bringing up
only the records matching that particular person.

Is this possible?

Scott


A "Parameter Query" is the technique you'ld use. Bear Jeff's good advice in
mind - selecting "Ravindranathan, Srinivasan" from a combo box is easier than
typing it! But you can use a paramter query with criteria such as

=[Enter last name:]

on the last name field, and also

=[Enter first name:]

on the first name field. Better would be to have an unbound Combo Box cboName
on a form (let's call it frmMyForm); this would have the unique personID as
its bound column, and you'ld use a criterion on the PersonID field of

=[Forms]![frmMyForm]![cboName]

If your names table doesn't have a unique person ID... it should. Names change
and they are not unique.

--

John W. Vinson [MVP]


All good suggestions. I will play around with which one works best for my
situation. Just a sidenote. In this particular search of the subject you
already know his full name. I do like the combobox idea though.

Thanks to everyone.

Scott

  #7  
Old February 7th, 2009, 04:12 PM posted to microsoft.public.access.gettingstarted
Srowe
external usenet poster
 
Posts: 34
Default Parameter Query

Thanks Jeff.

One issue I am having is that upon picking which name you want not all of
the associated fields are filling in. In particular The S1Sex field and the
S1Maidenname field. They are in the query but they are not showing up in the
drop down of the combobox when I type in the Surname.

Any suggestions?

Scott

"Jeff Boyce" wrote:

Scott

Possible, yes. Desirable, not much!

If you want your users to find a particular person, why are you forcing them
to remember the person's name, AND to spell (and punctuate) it properly?

If you create a form, add a combobox, and base that combobox on a query that
lists all available persons by LastName, FirstName, the users will be able
to PICK the one they want.

Regards

Jeff Boyce
Microsoft Office/Access MVP

"Srowe" wrote in message
...
I have a query setup for the user to search for a person using the lastname
field. What I would like to do is narrow it down further by having the
query
ask the user to input the lastname and then the first name. Thus bringing
up
only the records matching that particular person.

Is this possible?

Scott




  #8  
Old February 7th, 2009, 06:00 PM posted to microsoft.public.access.gettingstarted
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Parameter Query

On Sat, 7 Feb 2009 07:36:01 -0800, Srowe
wrote:

In this particular search of the subject you
already know his full name. I do like the combobox idea though.


That's an even stronger reason to use the combo box, just to save typing: with
the default Autocomplete property set the user need only type the first few
letters, and needn't worry about spelling errors.
--

John W. Vinson [MVP]
  #9  
Old February 9th, 2009, 04:12 PM posted to microsoft.public.access.gettingstarted
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Parameter Query

The whole reason for using a query here is because you can create a new
"field" in the query:
NewField: [LastName] & ", " & [FirstName]

Regards

Jeff Boyce
Microsoft Office/Access MVP

"Rich Wonneberger" wrote in message
...
Jeff,

Can this work if the first and last names are separate fields?

If a table had the 2 fields, could a query have the combo box like that?

I work mostly in a query.

TIA
Rich W.


Jeff Boyce wrote:

If you create a form, add a combobox, and base that combobox on a query
that lists all available persons by LastName, FirstName, the users will
be able to PICK the one they want.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:42 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.