473,382 Members | 1,665 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Using seek to find if a record exists

I'm trying to use seek to check for the existence of a record before
saving, so there are no duplicate entries (is there another way?). I
have a "groups" table, which has

GroupID
Island
GroupName

My code right now is giving me a "type mismatch" error, and this is what
it looks like:

Dim rsGroups As Recordset
Set rsGroups = CurrentDb.OpenRecordset("tblGroups")

rsGroups.Seek Form_frmGroups.txtGroupName

If rsGroups.EOF Then
MsgBox "Value not found"

' DoCmd.Save
' Form_frmGroups.AllowAdditions = False
' Form_frmGroups.AllowEdits = False

Else
MsgBox "Value already found in database"

End If

Can anyone offer some suggestions or hints?

Kevin
Dec 22 '05 #1
33 11267
To use Seek, you must specify the index name (which must be on the field you
are seeking), and then you must specify the operator (probably "=".)

But that approach is not very flexible, e.g. if fails if you split the
database later, because Seek works only on recordsets of type dbOpenTable
(i.e. not attached tables.) A DLookup() would be simpler and more flexible.

This example assumes tblGroups has a primary key named GroupID, and it
avoids the search if the value has not changed (so an existing record does
not find itself):
Dim strWhere As String
Dim varResult As Variant

With Me.txtGroupName
If IsNull(.Value) Or (.Value = .OldValue) Then
'do nothing
Else
strWhere = "[GroupName] = """ & .Value & """"
varResult = DLookup("GroupID", "tblGroups", strWhere)
If Not IsNull(varResult) Then
MsgBox "Group" & varResult & " has the same value."
End If
End If
End With

Note: If GroupName is a Number field (not a Text field), lose the extra
quotes:
strWhere = "[GroupName] = " & .Value

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Kevin Brammer" <kd*****@msn.com> wrote in message
news:MP****************@tornado.socal.rr.com...
I'm trying to use seek to check for the existence of a record before
saving, so there are no duplicate entries (is there another way?). I have
a "groups" table, which has

GroupID
Island
GroupName

My code right now is giving me a "type mismatch" error, and this is what
it looks like:

Dim rsGroups As Recordset
Set rsGroups = CurrentDb.OpenRecordset("tblGroups")

rsGroups.Seek Form_frmGroups.txtGroupName

If rsGroups.EOF Then
MsgBox "Value not found"

' DoCmd.Save
' Form_frmGroups.AllowAdditions = False
' Form_frmGroups.AllowEdits = False

Else
MsgBox "Value already found in database"

End If

Can anyone offer some suggestions or hints?

Kevin

Dec 22 '05 #2
Per Allen Browne:
To use Seek, you must specify the index name (which must be on the field you
are seeking), and then you must specify the operator (probably "=".)

But that approach is not very flexible, e.g. if fails if you split the
database later, because Seek works only on recordsets of type dbOpenTable
(i.e. not attached tables.) A DLookup() would be simpler and more flexible.


Actually, you can .Seek an attached table.

The trick is to Dim/Set a pointer to the database that the table is in.

e.g.
-------------------------------------------------------------------
Public Function EmployeeExist(byVal theEmployeeNumber As Long) As Boolean

Dim myDB as DAO.Database
Dim myRS As DAO.Recordset

Set myDB = dbEngine(0).OpenDatabase("M:\Whatever\Payroll.mdb" )

Set myRS = myDB.OpenRecordset("tblEmployee", dbOpenTable)
With myRS
.Index = "PrimaryKey"
.Seek "=", theEmployeeNumber
If .NoMatch = False Then
EmployeeExist = True
End If
(or, if you want to be cute: EmployeeExist = Not .NoMatch
.Close
End With

Set myRS = Nothing
set myDB = Nothing
End Function

-------------------------------------------------------------------
--
PeteCresswell
Dec 22 '05 #3
(PeteCresswell) wrote:
Per Allen Browne:
To use Seek, you must specify the index name (which must be on the field you
are seeking), and then you must specify the operator (probably "=".)

But that approach is not very flexible, e.g. if fails if you split the
database later, because Seek works only on recordsets of type dbOpenTable
(i.e. not attached tables.) A DLookup() would be simpler and more flexible.


Actually, you can .Seek an attached table.

The trick is to Dim/Set a pointer to the database that the table is in.

e.g.
-------------------------------------------------------------------
Public Function EmployeeExist(byVal theEmployeeNumber As Long) As Boolean

Dim myDB as DAO.Database
Dim myRS As DAO.Recordset

Set myDB = dbEngine(0).OpenDatabase("M:\Whatever\Payroll.mdb" )

Set myRS = myDB.OpenRecordset("tblEmployee", dbOpenTable)
With myRS
.Index = "PrimaryKey"
.Seek "=", theEmployeeNumber
If .NoMatch = False Then
EmployeeExist = True
End If
(or, if you want to be cute: EmployeeExist = Not .NoMatch
.Close
End With

Set myRS = Nothing
set myDB = Nothing
End Function

-------------------------------------------------------------------


When ducks honk they are geese.

--
Lyle Fairfield
Dec 22 '05 #4
Hi Kevin

I wouldn't use Seek at all.

Just open your recordset based on "WHERE GroupName = " & QUOTE &
Me.txtGroupName & QUOTE

The QUOTE is a global that I use which is simply a double set of
quotation marks. When using a string as a parameter for an SQL
statement it needs to be enclosed in these double quotes. That is why
you are getting your mismatch error.

After opening the recordset, your next line is:

If rsGroups.BOF and rsGroups.EOF then
'You've got an empty recordset and therefore the group isn't in
the table
' Do what you wanndo
end if

Dec 22 '05 #5
Kevin, I'm going to join this mishmash of suggestions, although you
have probably already implemented one. What I would do is simply make
the GroupName a primary key (No Duplicates) in your underlying table.
You would just have an extra primary key (as opposed to making
GroupName your ONLY primary key). In this approach, any effort to add a
record with the same GroupName as an existing one would result in an
error. On Error Resume next works well, but you could trap that
specific error if you wanted to.

Dec 22 '05 #6
Kevin Brammer <kd*****@msn.com> wrote in
news:MP****************@tornado.socal.rr.com:
I'm trying to use seek to check for the existence of a record
before saving


Why not just do a SELECT on the values that you're trying to match,
and if the result has a non-zero number of records, you know it's a
duplicate?

I never use SEEK. Ever.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 22 '05 #7
"Steve" <th*********@gmail.com> wrote in
news:11**********************@o13g2000cwo.googlegr oups.com:
Kevin, I'm going to join this mishmash of suggestions, although
you have probably already implemented one. What I would do is
simply make the GroupName a primary key (No Duplicates) in your
underlying table. You would just have an extra primary key (as
opposed to making GroupName your ONLY primary key). In this
approach, any effort to add a record with the same GroupName as an
existing one would result in an error. On Error Resume next works
well, but you could trap that specific error if you wanted to.


This response confuses me.

A primary key, by definition, can only be "primary" if there's only
one of them in a table. Suggesting adding another primary key would
be like saying "this is the first, and this is the other first."

I believe what you mean is adding a unique index on the other field.
The downside of this is that for that to work, it has to prohibit
Nulls.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 22 '05 #8
Br
David W. Fenton wrote:
"Steve" <th*********@gmail.com> wrote in
news:11**********************@o13g2000cwo.googlegr oups.com:
Kevin, I'm going to join this mishmash of suggestions, although
you have probably already implemented one. What I would do is
simply make the GroupName a primary key (No Duplicates) in your
underlying table. You would just have an extra primary key (as
opposed to making GroupName your ONLY primary key). In this
approach, any effort to add a record with the same GroupName as an
existing one would result in an error. On Error Resume next works
well, but you could trap that specific error if you wanted to.


This response confuses me.

A primary key, by definition, can only be "primary" if there's only
one of them in a table. Suggesting adding another primary key would
be like saying "this is the first, and this is the other first."

I believe what you mean is adding a unique index on the other field.
The downside of this is that for that to work, it has to prohibit
Nulls.


Hehe, yes you can only have one primary key :)
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Dec 22 '05 #9
On Thu, 22 Dec 2005 15:16:35 -0600, David W. Fenton wrote:
Kevin Brammer <kd*****@msn.com> wrote in
news:MP****************@tornado.socal.rr.com:
I'm trying to use seek to check for the existence of a record before
saving


Why not just do a SELECT on the values that you're trying to match, and if
the result has a non-zero number of records, you know it's a duplicate?

I never use SEEK. Ever.


I saw that in one of my searches as well. I may have to give it a try,
thanks!

Kevin
Dec 23 '05 #10
On Thu, 22 Dec 2005 06:31:46 -0800, summerwind wrote:
Hi Kevin

I wouldn't use Seek at all.

Just open your recordset based on "WHERE GroupName = " & QUOTE &
Me.txtGroupName & QUOTE

The QUOTE is a global that I use which is simply a double set of quotation
marks. When using a string as a parameter for an SQL statement it needs to
be enclosed in these double quotes. That is why you are getting your
mismatch error.

After opening the recordset, your next line is:

If rsGroups.BOF and rsGroups.EOF then
'You've got an empty recordset and therefore the group isn't in
the table
' Do what you wanndo
end if


Yet another great suggestion, I'll try this as well. :)

Kevin
Dec 23 '05 #11
On Thu, 22 Dec 2005 10:47:20 -0800, Steve wrote:
Kevin, I'm going to join this mishmash of suggestions, although you have
probably already implemented one. What I would do is simply make the
GroupName a primary key (No Duplicates) in your underlying table. You
would just have an extra primary key (as opposed to making GroupName your
ONLY primary key). In this approach, any effort to add a record with the
same GroupName as an existing one would result in an error. On Error
Resume next works well, but you could trap that specific error if you
wanted to.


Nope, I haven't implemented one yet. I'm a few hours behind all of you so
it takes me like 12 hours after my post to actually get to _try_ something. :)

Thanks,

Kevin
Dec 23 '05 #12
summerwind wrote:
Hi Kevin

I wouldn't use Seek at all.

Just open your recordset based on "WHERE GroupName = " & QUOTE &
Me.txtGroupName & QUOTE

The QUOTE is a global that I use which is simply a double set of
quotation marks. When using a string as a parameter for an SQL
statement it needs to be enclosed in these double quotes. That is why
you are getting your mismatch error.

After opening the recordset, your next line is:

If rsGroups.BOF and rsGroups.EOF then
'You've got an empty recordset and therefore the group isn't in
the table
' Do what you wanndo
end if


Any idea why this:

Dim rsGroups As Recordset
Set rsGroups = CurrentDb.OpenRecordset("SELECT * FROM tblGroups WHERE
GroupName =" & txtGroupName)

If rsGroups.BOF And rsGroups.EOF Then
'You've got an empty recordset and therefore the group isn't in

MsgBox "Value not found"

Else

MsgBox "Value already found in database"

End If

would produce "Too few parameters. Expected 1" error?

Kevin
Dec 23 '05 #13
Kevin Brammer wrote:
summerwind wrote:
Hi Kevin

I wouldn't use Seek at all.

Just open your recordset based on "WHERE GroupName = " & QUOTE &
Me.txtGroupName & QUOTE

The QUOTE is a global that I use which is simply a double set of
quotation marks. When using a string as a parameter for an SQL
statement it needs to be enclosed in these double quotes. That is why
you are getting your mismatch error.

After opening the recordset, your next line is:

If rsGroups.BOF and rsGroups.EOF then
'You've got an empty recordset and therefore the group isn't in
the table
' Do what you wanndo
end if


Any idea why this:

Dim rsGroups As Recordset
Set rsGroups = CurrentDb.OpenRecordset("SELECT * FROM tblGroups WHERE
GroupName =" & txtGroupName)

If rsGroups.BOF And rsGroups.EOF Then
'You've got an empty recordset and therefore the group isn't in

MsgBox "Value not found"

Else

MsgBox "Value already found in database"

End If

would produce "Too few parameters. Expected 1" error?

Kevin


The variable txtGroupName most likely needs to be in quotes:

Set rsGroups = CurrentDb.OpenRecordset("SELECT * FROM tblGroups WHERE" & _
" GroupName = '" & txtGroupName & "'")

or needs to be converted to the appropriate type (Date, Boolean, etc...) in the SQL statement.

--
'---------------
'John Mishefske
'---------------
Dec 23 '05 #14
On Fri, 23 Dec 2005 07:35:01 GMT, Kevin Brammer <kd*****@msn.com> wrote:
summerwind wrote:
Hi Kevin

I wouldn't use Seek at all.

Just open your recordset based on "WHERE GroupName = " & QUOTE &
Me.txtGroupName & QUOTE

The QUOTE is a global that I use which is simply a double set of
quotation marks. When using a string as a parameter for an SQL
statement it needs to be enclosed in these double quotes. That is why
you are getting your mismatch error.

After opening the recordset, your next line is:

If rsGroups.BOF and rsGroups.EOF then
'You've got an empty recordset and therefore the group isn't in
the table
' Do what you wanndo
end if


Any idea why this:

Dim rsGroups As Recordset
Set rsGroups = CurrentDb.OpenRecordset("SELECT * FROM tblGroups WHERE
GroupName =" & txtGroupName)

If rsGroups.BOF And rsGroups.EOF Then
'You've got an empty recordset and therefore the group isn't in

MsgBox "Value not found"

Else

MsgBox "Value already found in database"

End If

would produce "Too few parameters. Expected 1" error?

Kevin


If GroupName is text it needs to be surounded by quotes in your WHERE clause.

Set rsGroups = CurrentDb.OpenRecordset("SELECT * FROM tblGroups
WHERE GroupName = " & chr(34) & txtGroupName & Chr(34) & ")"

Wayne Gillespie
Gosford NSW Australia
Dec 23 '05 #15
To prevent duplicates I create a unique index on the field or fields
that are not to be duplicated.
After that I let Access and Jet worry about duplicates.
When a user attempts to insert a duplicate, a quite "nice" message
comes up by default and the insert is denied.
There is no muss and no fuss. Perhaps you would prefer something more
user-friendly but this is sufficient for me.
It is also, TTBOMK, fool proof.

Dec 23 '05 #16
On Fri, 23 Dec 2005 03:30:49 -0800, Lyle Fairfield wrote:
To prevent duplicates I create a unique index on the field or fields that
are not to be duplicated.
After that I let Access and Jet worry about duplicates. When a user
attempts to insert a duplicate, a quite "nice" message comes up by default
and the insert is denied. There is no muss and no fuss. Perhaps you would
prefer something more user-friendly but this is sufficient for me. It is
also, TTBOMK, fool proof.


I was trying to figure something like this out. When I first started, I
went to the Index property in the database table design view. I can't
recall now why I opted against it, I'll have to look again.

Kevin
Dec 23 '05 #17
Actually, by definition, a "primary key" can be composed of more than
one field. Yes, there is only one primary key in each table, but it
doesn't have to be a single field, in Access. For example, using a
combination of LastName, FirstName, and Birthdate would still
constitute a primary key.

Dec 23 '05 #18
"Steve" <th*********@gmail.com> wrote in
news:11**********************@o13g2000cwo.googlegr oups.com:
Actually, by definition, a "primary key" can be composed of more
than one field. Yes, there is only one primary key in each table,
but it doesn't have to be a single field, in Access. For example,
using a combination of LastName, FirstName, and Birthdate would
still constitute a primary key.


Well, two comments about that:

1. in the context of the discussion, the suggestion was not to add
the other field to the existing PK, but to add another PK, which is
nonsense.

2. a compound primary key cannot have Nulls in any of the fields, so
your candidate compound key would be an extremely poor choice for a
PK.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 23 '05 #19
John Mishefske wrote:
The variable txtGroupName most likely needs to be in quotes:

Set rsGroups = CurrentDb.OpenRecordset("SELECT * FROM tblGroups WHERE" & _
" GroupName = '" & txtGroupName & "'")

or needs to be converted to the appropriate type (Date, Boolean, etc...)
in the SQL statement.


Worked for the SQL query, but now I'm getting a type mismatch. This
really boggles my mind..
Dec 23 '05 #20
Kevin Brammer <kd*****@msn.com> wrote in
news:VL*****************@tornado.socal.rr.com:
John Mishefske wrote:
The variable txtGroupName most likely needs to be in quotes:

Set rsGroups = CurrentDb.OpenRecordset("SELECT * FROM tblGroups
WHERE" & _
" GroupName = '" & txtGroupName & "'")

or needs to be converted to the appropriate type (Date, Boolean,
etc...) in the SQL statement.


Worked for the SQL query, but now I'm getting a type mismatch.
This really boggles my mind..


Try this:

Dim strSQL As String

strSQL = ""SELECT * FROM tblGroups WHERE "
strSQL = strSQL & " GroupName = '" & txtGroupName & "'"
Debug.Print strSQL
Set rsGroups = CurrentDb.OpenRecordset(strSQL)

If it fails, you can then look in the Debug/Immediate window at
exactly what string was actually passed to your OpenRecordset.

You might also try replacing the single quotes with double quotes.
Probably the easiest way to do this on the fly is:

strSQL = strSQL & " GroupName = " & Chr(34) & txtGroupName & Chr(34)

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 24 '05 #21
David W. Fenton wrote:
Try this:

Dim strSQL As String

strSQL = ""SELECT * FROM tblGroups WHERE "
strSQL = strSQL & " GroupName = '" & txtGroupName & "'"
Debug.Print strSQL
Set rsGroups = CurrentDb.OpenRecordset(strSQL)


That worked! Now, what's different besides you defined the SQL ahead of
time?
Dec 24 '05 #22
Kevin Brammer <kd*****@msn.com> wrote:
: David W. Fenton wrote:

:> Try this:
:>
:> Dim strSQL As String
:>
:> strSQL = ""SELECT * FROM tblGroups WHERE "
^
|second quote is missing in statement below.
*******************************************

:> strSQL = strSQL & " GroupName = '" & txtGroupName & "'"
:> Debug.Print strSQL
:> Set rsGroups = CurrentDb.OpenRecordset(strSQL)
:>

: That worked! Now, what's different besides you defined the SQL ahead of
: time?

This is what you had in another post:
Set rsGroups = CurrentDb.OpenRecordset("SELECT * FROM tblGroups WHERE" & _
" GroupName = '" & txtGroupName & "'")


tiny, tiny details can make lots of trouble.
--thelma
Dec 24 '05 #23
Kevin Brammer <kd*****@msn.com> wrote in
news:N7*****************@tornado.socal.rr.com:
David W. Fenton wrote:
Try this:

Dim strSQL As String

strSQL = ""SELECT * FROM tblGroups WHERE "
strSQL = strSQL & " GroupName = '" & txtGroupName & "'"
Debug.Print strSQL
Set rsGroups = CurrentDb.OpenRecordset(strSQL)


That worked! Now, what's different besides you defined the SQL
ahead of time?


If you pasted as is, it shouldn't have worked. The double quote at
the beginning is wrong.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 24 '05 #24
On Sat, 24 Dec 2005 13:39:26 -0600, David W. Fenton wrote:
Kevin Brammer <kd*****@msn.com> wrote in
news:N7*****************@tornado.socal.rr.com:
David W. Fenton wrote:
Try this:

Dim strSQL As String

strSQL = ""SELECT * FROM tblGroups WHERE " strSQL = strSQL & "
GroupName = '" & txtGroupName & "'" Debug.Print strSQL
Set rsGroups = CurrentDb.OpenRecordset(strSQL)

That worked! Now, what's different besides you defined the SQL ahead of
time?


If you pasted as is, it shouldn't have worked. The double quote at the
beginning is wrong.


I took it out before I ran the code. :)

Thanks again,

Kevin
Dec 25 '05 #25
>. in the context of the discussion, the suggestion was not to add
the other field to the existing PK, but to add another PK, which is
nonsense.
2. a compound primary key cannot have Nulls in any of the fields, so
your candidate compound key would be an extremely poor choice for a
PK.


1. You are absolutely correct; I used the wrong terminology.

2. Using a Birthdate field as part of a primary key would not be a poor
decision if the birthdate were required for all records. An example of
a situation where a birthdate would be required is a hospital keeping
track of birth rates.

Dec 27 '05 #26

"Steve" <th*********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
. in the context of the discussion, the suggestion was not to add
the other field to the existing PK, but to add another PK, which is
nonsense.
2. a compound primary key cannot have Nulls in any of the fields, so
your candidate compound key would be an extremely poor choice for a
PK.


1. You are absolutely correct; I used the wrong terminology.

2. Using a Birthdate field as part of a primary key would not be a poor
decision if the birthdate were required for all records. An example of
a situation where a birthdate would be required is a hospital keeping
track of birth rates.


IMO - birthdate is still a poor choice for a primary key. Yes, combined with
other attributes it could be part of a unique PK. The PK, however, should do
nothing but guarantee unique identification of a record. "Smart keys" are a
bad idea.

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.

Dec 27 '05 #27
"Steve" <th*********@gmail.com> wrote in
news:11**********************@o13g2000cwo.googlegr oups.com:
. in the context of the discussion, the suggestion was not to add
the other field to the existing PK, but to add another PK, which
is nonsense.

2. a compound primary key cannot have Nulls in any of the fields,
so your candidate compound key would be an extremely poor choice
for a PK.


1. You are absolutely correct; I used the wrong terminology.

2. Using a Birthdate field as part of a primary key would not be a
poor decision if the birthdate were required for all records. An
example of a situation where a birthdate would be required is a
hospital keeping track of birth rates.


But one of the names almost always need to be blank in some small
number of records. I have never encountered a single application
where the compound key you describe could possibly have been used.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 27 '05 #28
In what scenario would a program recording birth records not have the
birthdate available? If a user is entering information about the births
at a hospital, the very nature of the work forces said user to already
have a birthdate to enter.

Dec 27 '05 #29
On 27 Dec 2005 13:57:13 -0800, "Steve" <th*********@gmail.com> wrote:
In what scenario would a program recording birth records not have the
birthdate available? If a user is entering information about the births
at a hospital, the very nature of the work forces said user to already
have a birthdate to enter.


But they may not yet know the baby's first name.

Wayne Gillespie
Gosford NSW Australia
Dec 28 '05 #30
"Steve" <th*********@gmail.com> wrote in
news:11**********************@g43g2000cwa.googlegr oups.com:
In what scenario would a program recording birth records not have
the birthdate available? If a user is entering information about
the births at a hospital, the very nature of the work forces said
user to already have a birthdate to enter.


I did *not* say there were *no* scenarios where it would work. I
just said there are plenty of them where it would *not*.

And, as Wayne points out, there can be a time be a time period, even
in a hospital, where you have a surname and a birthdate, but no
first name. It may not last long, but it means you couldn't always
enter a child in your database at birth if the parents hadn't yet
settled on the name.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 28 '05 #31
David W. Fenton <XX*******@dfenton.com.invalid> wrote:
: And, as Wayne points out, there can be a time be a time period, even
: in a hospital, where you have a surname and a birthdate, but no
: first name. It may not last long, but it means you couldn't always
: enter a child in your database at birth if the parents hadn't yet
: settled on the name.

My son came home from the hospital with the first name of
'Boy Baby', so the hospital was ready to enter him into the
database, even if the entry would be suboptimal and already
in need of update.
--thelma
: --
: David W. Fenton http://www.dfenton.com/
: usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 28 '05 #32
And I did *not* say that it would work in every scenario. I just said
there are some in which it would.

Even if there is a nameless time period as you describe, the child's
first name could first be entered as an ambigious placemarker as
Thelma's experience indicates, until a name was decided upon. I would
think that the number of incidents where the parents have not yet
decided on a name by the time the birth is over with is relatively low.
If the hospital were to enter birth records in their system after the
birth certificate were issued, the problem becomes a non-issue.

Dec 28 '05 #33
"Steve" <th*********@gmail.com> wrote in
news:11**********************@g47g2000cwa.googlegr oups.com:
And I did *not* say that it would work in every scenario. I just
said there are some in which it would.

Even if there is a nameless time period as you describe, the
child's first name could first be entered as an ambigious
placemarker as Thelma's experience indicates, until a name was
decided upon. . . .
Any database design that requires the entry of fake data is a bad
design, in my opinion.
. . . I would
think that the number of incidents where the parents have not yet
decided on a name by the time the birth is over with is relatively
low. If the hospital were to enter birth records in their system
after the birth certificate were issued, the problem becomes a
non-issue.


The point is that names are very often an extremely poor candidate
for inclusion in a compound unique index.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Dec 28 '05 #34

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: ST | last post by:
Hi, I'm sort of in a rush here...I'm sort of new to vb.net and I'm trying to write the syntax to check a sql table to see if the record already exists based on firstname and lastname text fields...
1
by: Average Bear | last post by:
If anyone could help with this one, I am a bit puzzled. I understand you can create an index using two fields of a database, then use the seek method to find a record based on both fields. My...
1
by: David C. Barber | last post by:
I'm trying to determine if any matching records exist on a LIKE query performing a partial match of last names to a remote back-end database in the most efficient manner possible. LAN Traffic...
3
by: Sarah Smith via AccessMonster.com | last post by:
I am creating a database of documents that need to be worked on, are int eh proress of being worked on, and have been completed. Sometimes the same document (an updated version) comes back for more...
4
by: kufre | last post by:
How can I use three criteria to find a record? I've done this before where I only use one criteria to find a record and set the focus to that criteria only. Thanks in advance.
3
by: Randy | last post by:
I have been able to set up a Find Record Button on my switchboard to take me to a form with the correct case number by using a parameter query and macro. When I try to run the Find Record button...
6
by: Opie | last post by:
What would be a more efficient way for me to determine if a record in an SQL DB table exists? Right now, I have a try/catch like this: try {...
7
by: gjoneshtfc | last post by:
Hello I want to search my database for a vehicle registration number but before i can search using the Find Record button i created i have to click in the registration field so that it is that...
6
by: Matt | last post by:
I need some guidance on how to handle an issue. I have an .asp page that correctly queries a table and returns data if a 'job number' and week ending date exist and the user can update the...
6
by: Helena666 | last post by:
Hi Its been a while since I have built a database using access and vba and am a bit rusty. I am using a command button on a form to write a record to a table, using an append query. However I need...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.