Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / August 2006

Tip: Looking for answers? Try searching our database.

Find a certain key

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mommio2 - 31 Jul 2006 03:51 GMT
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!
Arvin Meyer [MVP] - 31 Jul 2006 04:15 GMT
Have a look at these 2 sample databases:

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

http://www.datastrat.com/Download/ExpandingSearch2K.zip
Signature

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

> Hi,
>     I have a menu screen that gives the options to add a new record, edit
[quoted text clipped - 8 lines]
> How exactly should I do this?  What commands do I need to make it go to
> that record? Thanks a bunch in advance!
Mommio2 - 01 Aug 2006 02:16 GMT
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!

> Have a look at these 2 sample databases:
>
[quoted text clipped - 13 lines]
>> 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!
Arvin Meyer [MVP] - 01 Aug 2006 03:16 GMT
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)
Signature

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

> 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
[quoted text clipped - 24 lines]
>>> 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!
John Vinson - 01 Aug 2006 03:22 GMT
>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
[quoted text clipped - 6 lines]
>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]
Mommio2 - 02 Aug 2006 08:11 GMT
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!

>>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
[quoted text clipped - 15 lines]
>
>                  John W. Vinson[MVP]
John Vinson - 02 Aug 2006 17:10 GMT
>     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]
Mommio2 - 02 Aug 2006 18:57 GMT
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

>>     Hey, that worked GREAT...well, almost!  Now, my only problem is that
>> it
[quoted text clipped - 9 lines]
>
>                  John W. Vinson[MVP]
tina - 31 Jul 2006 04:19 GMT
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

> Hi,
>      I have a menu screen that gives the options to add a new record, edit
[quoted text clipped - 8 lines]
> I do this?  What commands do I need to make it go to that record? Thanks a
> bunch in advance!
onedaywhen - 02 Aug 2006 12:35 GMT
> 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
[quoted text clipped - 3 lines]
>
> 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.

--
tina - 02 Aug 2006 14:07 GMT
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

> > 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
[quoted text clipped - 14 lines]
>
> --
onedaywhen - 02 Aug 2006 14:40 GMT
> 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.

--
Mommio2 - 02 Aug 2006 16:16 GMT
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.

>> 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
[quoted text clipped - 16 lines]
>
> --
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.