"On Enter" Property in a form

B

Bob

How can one use the "on enter" porperty in a form to check
for duplicates in the database? What would the expression
look like? Would the result be once you hit the enter key
to forward to the next field, will the expression check
the database at that time and give a result if there is a
match?
 
C

chris

There is no "on enter" event for a form
The "on enter" event for a control does not refer to the
enter key.
This event is fired when a control is in the process of
getting focus, but occurs before the "got Focus" event.
The best way to check for duplicates depends on how your
forms and tables are structured.
 
B

Bob

I have a form which is for contacts for prospecting. I am
entering in the same form businesses I have and have not
contacted. I would like to when entering the telephone
number, which is my very first field, have the database
get checked for that same number when I enter to preceed
to the next field which is the company name. And have the
database not to continue if the same telephone exist.
 
E

Eric Butts [MSFT]

Hi Bob,

Here's an article that should help:

ACC2000: How to Use Visual Basic for Applications to Check for Duplicate
Values in a Field
http://support.microsoft.com/default.aspx?scid=kb;en-us;209479

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights

--------------------
| Content-Class: urn:content-classes:message
| From: "Bob" <[email protected]>
| Sender: "Bob" <[email protected]>
| Subject: "On Enter" Property in a form
| Date: Wed, 10 Mar 2004 08:43:31 -0800
| Lines: 6
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcQGvtKKt7sNY54iTmKrf9Q5GqS8Iw==
| Newsgroups: microsoft.public.access.tablesdbdesign
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.access.tablesdbdesign:76919
| NNTP-Posting-Host: tk2msftngxa14.phx.gbl 10.40.1.166
| X-Tomcat-NG: microsoft.public.access.tablesdbdesign
|
| How can one use the "on enter" porperty in a form to check
| for duplicates in the database? What would the expression
| look like? Would the result be once you hit the enter key
| to forward to the next field, will the expression check
| the database at that time and give a result if there is a
| match?
|
 
G

Guest

What I can understand from your message,you basically do not want two of the exact phone numbers in your table?!
Therefor you can assign a primary key value to your field (right click table,design view).You can also try the following
1.Add a field to your table named "Contact Status" as a Boolean (Yes/No) field
2.Add a primary key to both "Telephone number" and "Contact Status"
3.Therefor you will never have two phone numbers with the same status,meaning that if you have contacted someone before,Access will warn if you try doing so again by saying you are entering a duplicate value.

----- Bob wrote: ----

I have a form which is for contacts for prospecting. I am
entering in the same form businesses I have and have not
contacted. I would like to when entering the telephone
number, which is my very first field, have the database
get checked for that same number when I enter to preceed
to the next field which is the company name. And have the
database not to continue if the same telephone exist
 
B

Bob

Thanks, this worked great. However, is there a specific
code that can be inserted within that existing code that
would ask in a popup window to accept "Yes or No". I am
not a programer, could you supply specifics?
 
E

Eric Butts [MSFT]

Hi Bob,

The following lines of code already in the article warns the user that the
value already exists:

If Not IsNull(x) Then
Beep
MsgBox "That value already exists", vbOKOnly, "Duplicate Value"
Cancel = True
End If

I guess what you want to add is the following:

Dim Response As String
If Not IsNull(x) Then
Beep
Response = MsgBox "That value already exists. Continue?", vbYesNo,
"Duplicate Value"
If Response = vbYes Then
Cancel = True
Else
Cancel = False
End If
End If

Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights

--------------------
| Content-Class: urn:content-classes:message
| From: "Bob" <[email protected]>
| Sender: "Bob" <[email protected]>
| References: <[email protected]>
<8O#[email protected]>
| Subject: RE: "On Enter" Property in a form
| Date: Fri, 12 Mar 2004 08:49:32 -0800hU
| Lines: 80
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcQIUf6TxVLFXbk0SaCuHEvDfQ+v4Q==
| Newsgroups: microsoft.public.access.tablesdbdesign
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.access.tablesdbdesign:77048
| NNTP-Posting-Host: tk2msftngxa12.phx.gbl 10.40.1.164
| X-Tomcat-NG: microsoft.public.access.tablesdbdesign
|
| Thanks, this worked great. However, is there a specific
| code that can be inserted within that existing code that
| would ask in a popup window to accept "Yes or No". I am
| not a programer, could you supply specifics?
| >-----Original Message-----
| >Hi Bob,
| >
| >Here's an article that should help:
| >
| >ACC2000: How to Use Visual Basic for Applications to
| Check for Duplicate
| >Values in a Field
| >http://support.microsoft.com/default.aspx?scid=kb;en-
| us;209479
| >
| >I hope this helps! If you have additional questions on
| this topic, please
| >respond back to this posting.
| >
| >
| >Regards,
| >
| >Eric Butts
| >Microsoft Access Support
| >[email protected]
| >"Microsoft Security Announcement: Have you installed the
| patch for
| >Microsoft Security Bulletin MS03-026? If not Microsoft
| strongly advises
| >you to review the information at the following link
| regarding Microsoft
| >Security Bulletin MS03-026
| ><http://www.microsoft.com/security/security_bulletins/ms03
| -026.asp> and/or
| >to visit Windows Update at
| <http://windowsupdate.microsoft.com/> to install
| >the patch. Running the SCAN program from the Windows
| Update site will help
| >to insure you are current with all security patches, not
| just MS03-026."
| >
| >This posting is provided "AS IS" with no warranties, and
| confers no rights
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "Bob" <[email protected]>
| >| Sender: "Bob" <[email protected]>
| >| Subject: "On Enter" Property in a form
| >| Date: Wed, 10 Mar 2004 08:43:31 -0800
| >| Lines: 6
| >| Message-ID: <[email protected]>
| >| MIME-Version: 1.0
| >| Content-Type: text/plain;
| >| charset="iso-8859-1"
| >| Content-Transfer-Encoding: 7bit
| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| >| Thread-Index: AcQGvtKKt7sNY54iTmKrf9Q5GqS8Iw==
| >| Newsgroups: microsoft.public.access.tablesdbdesign
| >| Path: cpmsftngxa06.phx.gbl
| >| Xref: cpmsftngxa06.phx.gbl
| microsoft.public.access.tablesdbdesign:76919
| >| NNTP-Posting-Host: tk2msftngxa14.phx.gbl 10.40.1.166
| >| X-Tomcat-NG: microsoft.public.access.tablesdbdesign
| >|
| >| How can one use the "on enter" porperty in a form to
| check
| >| for duplicates in the database? What would the
| expression
| >| look like? Would the result be once you hit the enter
| key
| >| to forward to the next field, will the expression check
| >| the database at that time and give a result if there is
| a
| >| match?
| >|
| >
| >.
| >
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top