Hi
We have a staff database and need to make sure that the same staff is not
entered twice. Is there a way for Access to flag if combination of forename
and surname fields is already in the system when adding a new record?
Preferably straight after entering forename & surname so user does not waste
time entering the rest of the info.
Thanks
Regards 6 1867
Well yes,
You are talking about making a natural primary key consisting of the
combination of surname and firstname fields.
One way is what I just mentioned, to specify this as your primary key.
Another way is to keep whatever key u already have in place (i.e., an
autonumber field) and enforce a uniqueness constraint on the combination of
those two fields. Select Indexed No Duplicates. I am pretty sure Access does
this for single-valued alternate keys, I am not sure it does it for a
combination of fields as in ur case, but I see no reason why it shouldn't (I
havn't tried it myself though).
hth
Konstantinos
PS: A primary key of first name and last name might be a bad idea
(especially if ur company is large) since it is often the case that people
have identical first and last names but are...well...di fferent people.
"John" <Jo**@nospam.in fovis.co.uk> wrote in message
news:41******** *************** @news-text.dial.pipex .com... Hi
We have a staff database and need to make sure that the same staff is not entered twice. Is there a way for Access to flag if combination of forename and surname fields is already in the system when adding a new record? Preferably straight after entering forename & surname so user does not waste time entering the rest of the info.
Thanks
Regards
Just out of interest, how does one define two separate fields as a primary
key in access?
"Kostas" <no*****@noemai l.net> wrote in message
news:10******** *****@corp.supe rnews.com... Well yes, You are talking about making a natural primary key consisting of the combination of surname and firstname fields. One way is what I just mentioned, to specify this as your primary key. Another way is to keep whatever key u already have in place (i.e., an autonumber field) and enforce a uniqueness constraint on the combination
of those two fields. Select Indexed No Duplicates. I am pretty sure Access
does this for single-valued alternate keys, I am not sure it does it for a combination of fields as in ur case, but I see no reason why it shouldn't
(I havn't tried it myself though). hth
Konstantinos
PS: A primary key of first name and last name might be a bad idea (especially if ur company is large) since it is often the case that people have identical first and last names but are...well...di fferent people.
"John" <Jo**@nospam.in fovis.co.uk> wrote in message news:41******** *************** @news-text.dial.pipex .com... Hi
We have a staff database and need to make sure that the same staff is
not entered twice. Is there a way for Access to flag if combination of forename and surname fields is already in the system when adding a new record? Preferably straight after entering forename & surname so user does not waste time entering the rest of the info.
Thanks
Regards
You go in Design View,
Select the first row
Pressing SHIFT select the second row
Continuing to have SHIFT pressed right-click on ur mouse,
Select Primary key,
Done.
Just out of interest, have you ever worked in Access before? I am not an
expert myself but I think you oughta know these things if building a
database for a business or hire someone that does.
Cheers!
Konstantinos
select both rows and left-click and choose Set as primary key
"John" <Jo**@nospam.in fovis.co.uk> wrote in message
news:41******** *************** @news-text.dial.pipex .com... Just out of interest, how does one define two separate fields as a primary key in access?
On Sat, 16 Oct 2004 02:06:02 +0100, "John" <Jo**@nospam.in fovis.co.uk>
wrote:
In the AfterUpdate event of the LastName field write:
if DCount("LastNam e", "tblStaff", "LastName=' " & Forms!MyForm!La stName
& "' AND FirstName='" & Forms!MyForm!Fi rstName & "'") > 0 then
msgbox "Alarm! Such firstname/lastname already exists!",vbCrit ical
end if
I'm sure you'll want to modify this code to a MsgBox(..., vbOkCancel)
and upon OK cancel the current record, and jump to the existing
record.
-Tom. Hi
We have a staff database and need to make sure that the same staff is not entered twice. Is there a way for Access to flag if combination of forename and surname fields is already in the system when adding a new record? Preferably straight after entering forename & surname so user does not waste time entering the rest of the info.
Thanks
Regards
"Kostas" <no*****@noemai l.net> wrote in
news:10******** *****@corp.supe rnews.com: You go in Design View, Select the first row Pressing SHIFT select the second row Continuing to have SHIFT pressed right-click on ur mouse, Select Primary key,
Done.
This works for adjacent fields in the list. Use [ctrl]-click for
non-adjacent fields. Its behaviour is the standard for multi-
select boxes or in windows explorer.
Bob
Just out of interest, have you ever worked in Access before? I am not an expert myself but I think you oughta know these things if building a database for a business or hire someone that does.
Cheers! Konstantinos
select both rows and left-click and choose Set as primary key "John" <Jo**@nospam.in fovis.co.uk> wrote in message news:41******** *************** @news-text.dial.pipex .com... Just out of interest, how does one define two separate fields as a primary key in access?
--
Bob Quintal
PA is y I've altered my email address.
Tom van Stiphout wrote: On Sat, 16 Oct 2004 02:06:02 +0100, "John" <Jo**@nospam.in fovis.co.uk> wrote:
In the AfterUpdate event of the LastName field write: if DCount("LastNam e", "tblStaff", "LastName=' " & Forms!MyForm!La stName & "' AND FirstName='" & Forms!MyForm!Fi rstName & "'") > 0 then msgbox "Alarm! Such firstname/lastname already exists!",vbCrit ical end if
I'm sure you'll want to modify this code to a MsgBox(..., vbOkCancel) and upon OK cancel the current record, and jump to the existing record.
This is why I also like autonumbers...s ince if I change the value in
last/first name and then restore to original value before moving on, it
will inform me that the record already exists.
WIth an autonumber you can also add
" And Employeeid <> " & Me.EmployeeID
in the Dcount so you are only checking other records besides the current
record. -Tom. Hi
We have a staff database and need to make sure that the same staff is not entered twice. Is there a way for Access to flag if combination of forename and surname fields is already in the system when adding a new record? Preferably straight after entering forename & surname so user does not waste time entering the rest of the info.
Thanks
Regards
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Domestos |
last post by:
Hi all,
How do I check in a mySQL table called 'Users' on column user_name when
registering a new user_name to make sure the new 'user_name' does not
already exist in that column?
TIA
|
by: Guillaume Dargaud |
last post by:
Hello, python beginner here,
How can I make sure that a given script is never run more than once at the
same time in a system ?
Besides checking 'ps' for its own name. Most modern langages have a direct
way to do that.
Thanks
--
Guillaume Dargaud
http://www.gdargaud.net/
"Here is your parachute and here is the manual.
|
by: news |
last post by:
I just upgraded to PHP 4.4.2 on my Slackware 10.2 system. And
Apache/mySQL/PHP all work great through a browser. No errors.
But when I try to run a PHP script through the command line, which I
need to do, I get blocks of errors like:
root@slackserve:/var/www/htdocs# php ./phptest.php
PHP Warning: Unknown(): Unable to load dynamic library
'/usr/lib/php/extensions/mysql.so' - libmysqlclient.so.14: cannot open
shared object file: No such...
|
by: Johan P |
last post by:
Having just compiled DBG 2.15.1 and trying to use it with PHP (cli)
give some some problem.
Verions:
DBG 2.15.1
PHP 4.4.4 (cli)
It works fine compiled with the Apache module but when I try to use it with
the client I get the following warnings trying to run the client version of
PHP.
|
by: Nbene |
last post by:
Hi All,
Hoping someone can help with this one.
I am opening a table and looping through the RecordSource (RcSr) of !
Email
I am trying to add each email address to the string (strEmail) for use
in sending to outlook.
| |
by: Narendra Gc |
last post by:
Hi...
I am looking after a lan . I am i am not able to access one particular system , by another one particular system. But from these computers i can access all other systems in my lan and vice- versa.only the communication between these two computers is affected.
Error is " A duplicate name exists on the network "
I searched in google i got the following solutions.
1)A. The "Duplicate name exists" error indicates the...
|
by: Gabriel Genellina |
last post by:
En Fri, 18 Apr 2008 12:23:08 -0300, Shawn Milochik <Shawn@Milochik.comescribió:
A dictionary with keys is perfectly reasonable. But a *list* of values has to be searched linearly for every value: a O(n) process. As your friend suggested, searching a dictionary requires O(1) time. A set is even better in this case, because you don't have any use for the values in the inner dictionary (sets and dictionaries are very similar in the...
|
by: john.cole |
last post by:
I have searched all the groups I can, and I still haven't been able to
come up the solution I need. I have the following problem.
In my form named sbfrmSpoolList, I am entering a job, spool and
revision number. My table is indexed properly to not allow
duplicates, but I would like teh user to be notified that they are
typing a duplicate via a message box, then I woulld the update of the
record to be cancelled. I have tried the...
|
by: Orbie |
last post by:
Hi All,
I'm new to VB.NET and i'm looking for some help with my Windows Form. I need to check if a Commodity entered into (TextBox1.Text) already exists on my table before i insert it. I'm having issues checking if the number of rows returned from my Select is equal 0? Also i'm wondering should i be checking for an exception and open/closing my connections each time i make a call to my DB or is the way i have it coded below OK??
Any input...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |