Group:  Microsoft Access ยป microsoft.public.access.gettingstarted
Thread: Find a certain key

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Find a certain key
"Mommio2" <mommio2[ at ]insightbb.com> 31.07.2006 02:51:08
Hi,
I have a menu screen that gives the options to add a new record, edit
an existing record, or run any of a number of reports. All are working
correctly except the edit. How can I cause it to go to a certain key? My
key is last name, first name. Let's say I have 3 Jones - Ann, Bob, & Mary.
I would like to be able to enter "Jones" or just "J" and go to the first one
(or to the beginning of the J's). Right now I have an edit button on my
menu screen that sends you to a macro. The macro has "go to" for the Record
field. I need to replace the button on the menu screen with a place to type
in the name or first letters of the name I want to find. How exactly should
I do this? What commands do I need to make it go to that record? Thanks a
bunch in advance!



Re: Find a certain key
"Arvin Meyer [MVP]" <a[ at ]m.com> 31.07.2006 03:15:33
Have a look at these 2 sample databases:

http://www.datastrat.com/Download/Search2K.zip

http://www.datastrat.com/Download/ExpandingSearch2K.zip
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

"Mommio2" <mommio2[ at ]insightbb.com> wrote in message
news:uk7ttwEtGHA.1196[ at ]TK2MSFTNGP04.phx.gbl...
[Quoted Text]
> Hi,
> I have a menu screen that gives the options to add a new record, edit
> an existing record, or run any of a number of reports. All are working
> correctly except the edit. How can I cause it to go to a certain key? My
> key is last name, first name. Let's say I have 3 Jones - Ann, Bob, & Mary.
> I would like to be able to enter "Jones" or just "J" and go to the first
> one (or to the beginning of the J's). Right now I have an edit button on
> my menu screen that sends you to a macro. The macro has "go to" for the
> Record field. I need to replace the button on the menu screen with a
> place to type in the name or first letters of the name I want to find.
> How exactly should I do this? What commands do I need to make it go to
> that record? Thanks a bunch in advance!
>
>
>


Re: Find a certain key
"tina" <nospam[ at ]address.com> 31.07.2006 03:19:51
all other issues aside, i recommend against using a person's name as a
primary key for a table. pick up the phone directory in any town, and you
can see that there are lots of common, duplicate names in this world, even
in small geographic areas. what happens when you have to enter another Mary
Jones?

suggest you use an Autonumber field as the primary key for your table.

hth


"Mommio2" <mommio2[ at ]insightbb.com> wrote in message
news:uk7ttwEtGHA.1196[ at ]TK2MSFTNGP04.phx.gbl...
[Quoted Text]
> Hi,
> I have a menu screen that gives the options to add a new record, edit
> an existing record, or run any of a number of reports. All are working
> correctly except the edit. How can I cause it to go to a certain key? My
> key is last name, first name. Let's say I have 3 Jones - Ann, Bob, & Mary.
> I would like to be able to enter "Jones" or just "J" and go to the first
one
> (or to the beginning of the J's). Right now I have an edit button on my
> menu screen that sends you to a macro. The macro has "go to" for the
Record
> field. I need to replace the button on the menu screen with a place to
type
> in the name or first letters of the name I want to find. How exactly
should
> I do this? What commands do I need to make it go to that record? Thanks a
> bunch in advance!
>
>
>


Re: Find a certain key
"Mommio2" <mommio2[ at ]insightbb.com> 01.08.2006 01:16:40
Thanks, but I have been looking and looking at them, and they are waaayyy
over my head! Is there a simple way to just enter the first 3 letters of
the desired last name into a text box and have it search the table for the
first entry beginning with those 3 letters? Would a query do it? I'd like
to be able to do this on the first menu screen and then have it take me
right to the form which I will use to update the record. This will be a
very small table (less than 200 entries), so it is OK for the user to go to
the first one and then page through until they find the right one. Also,
how do I specify that I want just the first three letters of
Student_Last_Name? Thanks!




"Arvin Meyer [MVP]" <a[ at ]m.com> wrote in message
news:uG39Y%23EtGHA.5044[ at ]TK2MSFTNGP05.phx.gbl...
[Quoted Text]
> Have a look at these 2 sample databases:
>
> http://www.datastrat.com/Download/Search2K.zip
>
> http://www.datastrat.com/Download/ExpandingSearch2K.zip
> --
> Arvin Meyer, MCP, MVP
> Microsoft Access
> Free Access downloads
> http://www.datastrat.com
> http://www.mvps.org/access
>
> "Mommio2" <mommio2[ at ]insightbb.com> wrote in message
> news:uk7ttwEtGHA.1196[ at ]TK2MSFTNGP04.phx.gbl...
>> Hi,
>> I have a menu screen that gives the options to add a new record, edit
>> an existing record, or run any of a number of reports. All are working
>> correctly except the edit. How can I cause it to go to a certain key?
>> My key is last name, first name. Let's say I have 3 Jones - Ann, Bob, &
>> Mary. I would like to be able to enter "Jones" or just "J" and go to the
>> first one (or to the beginning of the J's). Right now I have an edit
>> button on my menu screen that sends you to a macro. The macro has "go
>> to" for the Record field. I need to replace the button on the menu
>> screen with a place to type in the name or first letters of the name I
>> want to find. How exactly should I do this? What commands do I need to
>> make it go to that record? Thanks a bunch in advance!
>>
>>
>>
>
>


Re: Find a certain key
"Arvin Meyer [MVP]" <a[ at ]m.com> 01.08.2006 02:16:45
You cannot do it very well from a textbox unless you do it similarly to the
code I posted. Your alternative is to use a combo box (sometimes called a
dropdown box). Make sure that that the auto-expand property is set to yes
(the default)
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

"Mommio2" <mommio2[ at ]insightbb.com> wrote in message
news:ek0mJhQtGHA.2020[ at ]TK2MSFTNGP03.phx.gbl...
[Quoted Text]
> Thanks, but I have been looking and looking at them, and they are waaayyy
> over my head! Is there a simple way to just enter the first 3 letters of
> the desired last name into a text box and have it search the table for the
> first entry beginning with those 3 letters? Would a query do it? I'd like
> to be able to do this on the first menu screen and then have it take me
> right to the form which I will use to update the record. This will be a
> very small table (less than 200 entries), so it is OK for the user to go
> to the first one and then page through until they find the right one.
> Also, how do I specify that I want just the first three letters of
> Student_Last_Name? Thanks!
>
>
>
>
> "Arvin Meyer [MVP]" <a[ at ]m.com> wrote in message
> news:uG39Y%23EtGHA.5044[ at ]TK2MSFTNGP05.phx.gbl...
>> Have a look at these 2 sample databases:
>>
>> http://www.datastrat.com/Download/Search2K.zip
>>
>> http://www.datastrat.com/Download/ExpandingSearch2K.zip
>> --
>> Arvin Meyer, MCP, MVP
>> Microsoft Access
>> Free Access downloads
>> http://www.datastrat.com
>> http://www.mvps.org/access
>>
>> "Mommio2" <mommio2[ at ]insightbb.com> wrote in message
>> news:uk7ttwEtGHA.1196[ at ]TK2MSFTNGP04.phx.gbl...
>>> Hi,
>>> I have a menu screen that gives the options to add a new record,
>>> edit an existing record, or run any of a number of reports. All are
>>> working correctly except the edit. How can I cause it to go to a
>>> certain key? My key is last name, first name. Let's say I have 3 Jones -
>>> Ann, Bob, & Mary. I would like to be able to enter "Jones" or just "J"
>>> and go to the first one (or to the beginning of the J's). Right now I
>>> have an edit button on my menu screen that sends you to a macro. The
>>> macro has "go to" for the Record field. I need to replace the button on
>>> the menu screen with a place to type in the name or first letters of the
>>> name I want to find. How exactly should I do this? What commands do I
>>> need to make it go to that record? Thanks a bunch in advance!
>>>
>>>
>>>
>>
>>
>
>


Re: Find a certain key
John Vinson <jvinson[ at ]STOP_SPAM.WysardOfInfo.com> 01.08.2006 02:22:35
On Mon, 31 Jul 2006 21:16:40 -0400, "Mommio2" <mommio2[ at ]insightbb.com>
wrote:

[Quoted Text]
>Thanks, but I have been looking and looking at them, and they are waaayyy
>over my head! Is there a simple way to just enter the first 3 letters of
>the desired last name into a text box and have it search the table for the
>first entry beginning with those 3 letters? Would a query do it? I'd like
>to be able to do this on the first menu screen and then have it take me
>right to the form which I will use to update the record. This will be a
>very small table (less than 200 entries), so it is OK for the user to go to
>the first one and then page through until they find the right one. Also,
>how do I specify that I want just the first three letters of
>Student_Last_Name? Thanks!

Rather than a textbox, consider using a Combo Box based on a query
sorted by last name. The COmbo Box Wizard will create a combo for you
to find a record based on the selection, and the combo box will indeed
autofill for you - if you type CZA it will jump right to the line for
young Mr. Czarecki.

John W. Vinson[MVP]
Re: Find a certain key
"Mommio2" <mommio2[ at ]insightbb.com> 02.08.2006 07:11:23
Hey, that worked GREAT...well, almost! Now, my only problem is that it
lets me choose the last name from the combo box and then it takes me to the
form for updating, but it is positioned at the first record in the form, not
the one I chose in the combo box. Do I have to check for " = to "
somewhere? Thanks!

"John Vinson" <jvinson[ at ]STOP_SPAM.WysardOfInfo.com> wrote in message
news:1ketc2l29tm4qibssns81lvb98pue3s26c[ at ]4ax.com...
[Quoted Text]
> On Mon, 31 Jul 2006 21:16:40 -0400, "Mommio2" <mommio2[ at ]insightbb.com>
> wrote:
>
>>Thanks, but I have been looking and looking at them, and they are waaayyy
>>over my head! Is there a simple way to just enter the first 3 letters of
>>the desired last name into a text box and have it search the table for the
>>first entry beginning with those 3 letters? Would a query do it? I'd like
>>to be able to do this on the first menu screen and then have it take me
>>right to the form which I will use to update the record. This will be a
>>very small table (less than 200 entries), so it is OK for the user to go
>>to
>>the first one and then page through until they find the right one. Also,
>>how do I specify that I want just the first three letters of
>>Student_Last_Name? Thanks!
>
> Rather than a textbox, consider using a Combo Box based on a query
> sorted by last name. The COmbo Box Wizard will create a combo for you
> to find a record based on the selection, and the combo box will indeed
> autofill for you - if you type CZA it will jump right to the line for
> young Mr. Czarecki.
>
> John W. Vinson[MVP]


Re: Find a certain key
"onedaywhen" <jamiecollins[ at ]xsmail.com> 02.08.2006 11:35:52

tina wrote:
[Quoted Text]
> i recommend against using a person's name as a
> primary key for a table. pick up the phone directory in any town, and you
> can see that there are lots of common, duplicate names in this world, even
> in small geographic areas. what happens when you have to enter another Mary
> Jones?
>
> suggest you use an Autonumber field as the primary key for your table.

How then would you know whether the second is Mary Jones is not the
same Mary Jones entered a second time? i.e. an autonumber PK without a
natural key *facilitates* duplicates rather than preventing them.

Going with your phone directory idea, phone number would make a better
identifier than an autonumber (but not much).

Jamie.

--

Re: Find a certain key
"tina" <nospam[ at ]address.com> 02.08.2006 13:07:13
if there are additional fields in the table that, taken together, serve to
identify Mary Jones uniquely, then i would create a multi-field unique index
to help the user identify duplicate records at the time of data entry. since
i rarely use multi-field primary keys, my autonumber recommendation stands.

the use of surrogate keys v. natural keys has been debated in these
newsgroups numerous times, so i'm not going to engage in such a debate in
this thread. any reader who's interested in the issue need only google the
newsgroups to read those discussions.

hth


"onedaywhen" <jamiecollins[ at ]xsmail.com> wrote in message
news:1154518552.659054.104700[ at ]b28g2000cwb.googlegroups.com...
[Quoted Text]
>
> tina wrote:
> > i recommend against using a person's name as a
> > primary key for a table. pick up the phone directory in any town, and
you
> > can see that there are lots of common, duplicate names in this world,
even
> > in small geographic areas. what happens when you have to enter another
Mary
> > Jones?
> >
> > suggest you use an Autonumber field as the primary key for your table.
>
> How then would you know whether the second is Mary Jones is not the
> same Mary Jones entered a second time? i.e. an autonumber PK without a
> natural key *facilitates* duplicates rather than preventing them.
>
> Going with your phone directory idea, phone number would make a better
> identifier than an autonumber (but not much).
>
> Jamie.
>
> --
>


Re: Find a certain key
"onedaywhen" <jamiecollins[ at ]xsmail.com> 02.08.2006 13:40:49

tina wrote:
[Quoted Text]
> the use of surrogate keys v. natural keys has been debated in these
> newsgroups numerous times, so i'm not going to engage in such a debate in
> this thread. any reader who's interested in the issue need only google the
> newsgroups to read those discussions.

And each of those threads contains a lot of noise, so I'll briefly
state the outcome: a surrogate needs a candidate key. Thus, a more apt
caption would be surrogate+natural key v natural key.

Jamie.

--

Re: Find a certain key
"Mommio2" <mommio2[ at ]insightbb.com> 02.08.2006 15:16:41
Thanks for your suggestions, and I will talk it over with my principal, but
we are a very small school - only 175 students in K - 8th. The chances of
us getting 2 kids with the same 1st, middle, and last names are not very
high. I appreciate it, though, and we will certainly discuss.

"onedaywhen" <jamiecollins[ at ]xsmail.com> wrote in message
news:1154518552.659054.104700[ at ]b28g2000cwb.googlegroups.com...
[Quoted Text]
>
> tina wrote:
>> i recommend against using a person's name as a
>> primary key for a table. pick up the phone directory in any town, and you
>> can see that there are lots of common, duplicate names in this world,
>> even
>> in small geographic areas. what happens when you have to enter another
>> Mary
>> Jones?
>>
>> suggest you use an Autonumber field as the primary key for your table.
>
> How then would you know whether the second is Mary Jones is not the
> same Mary Jones entered a second time? i.e. an autonumber PK without a
> natural key *facilitates* duplicates rather than preventing them.
>
> Going with your phone directory idea, phone number would make a better
> identifier than an autonumber (but not much).
>
> Jamie.
>
> --
>


Re: Find a certain key
John Vinson <jvinson[ at ]STOP_SPAM.WysardOfInfo.com> 02.08.2006 16:10:48
On Wed, 2 Aug 2006 03:11:23 -0400, "Mommio2" <mommio2[ at ]insightbb.com>
wrote:

[Quoted Text]
> Hey, that worked GREAT...well, almost! Now, my only problem is that it
>lets me choose the last name from the combo box and then it takes me to the
>form for updating, but it is positioned at the first record in the form, not
>the one I chose in the combo box. Do I have to check for " = to "
>somewhere? Thanks!

Please post the code. I have no idea what problem you're having
because I can't see what you're doing!

John W. Vinson[MVP]
Re: Find a certain key
"Mommio2" <mommio2[ at ]insightbb.com> 02.08.2006 17:57:52
Thanks, but I did it again! Every time I think I am totally stuck and can't
go on alone, I keep thinking about it and the cobwebs seem to clear away and
I get it! It is now working! Thanks a bunch for all the suggestions and
help, everyone! Couldn't do it without ya!
Mommio2




"John Vinson" <jvinson[ at ]STOP_SPAM.WysardOfInfo.com> wrote in message
news:ejj1d2todk72m4o84r146p46ptr3ehr6bk[ at ]4ax.com...
[Quoted Text]
> On Wed, 2 Aug 2006 03:11:23 -0400, "Mommio2" <mommio2[ at ]insightbb.com>
> wrote:
>
>> Hey, that worked GREAT...well, almost! Now, my only problem is that
>> it
>>lets me choose the last name from the combo box and then it takes me to
>>the
>>form for updating, but it is positioned at the first record in the form,
>>not
>>the one I chose in the combo box. Do I have to check for " = to "
>>somewhere? Thanks!
>
> Please post the code. I have no idea what problem you're having
> because I can't see what you're doing!
>
> John W. Vinson[MVP]


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net