473,413 Members | 1,733 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,413 software developers and data experts.

Searching for Duplicates

sorry for the basic question, but:

I have users entering a serial number on a form in a text box that is
bounded and called via a query. Prior to allowing that number to be
entered into the table, I need to make sure it's not a duplicate. I
can't use the primary key here, so I need some vb code to do the
search the table.

I tried Dlookup, but it seems to trigger as soon as I enter a serial
number for the second case, even if it is not the same as the first
case.

Here's the code I am using:

= DLookup("[name]", "Assignment Table", "forms![assignment
table]![txtserial] = forms![assignment table]![txtserial]")

Any help would be appreciated.
Thanks
Nov 12 '05 #1
1 1341
Here are two suggestions ---

1. Go back to the table that your form is based on and open it in design view.
Select the [via a query] field and in the bottom section set indexes to No
Duplicates.

2. DLookup is the wrong function to use; try DCount in the BeforeUpdate event
of the textbox.
If DCount("[via a query]", "Assignment Table", _
"[via a query] = " & forms![assignment table]![via a query]) <> 0 Then
<<Your code to handle the duplicate>>
End If
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

<lo**@aol.com> wrote in message
news:97********************************@4ax.com...
sorry for the basic question, but:

I have users entering a serial number on a form in a text box that is
bounded and called via a query. Prior to allowing that number to be
entered into the table, I need to make sure it's not a duplicate. I
can't use the primary key here, so I need some vb code to do the
search the table.

I tried Dlookup, but it seems to trigger as soon as I enter a serial
number for the second case, even if it is not the same as the first
case.

Here's the code I am using:

= DLookup("[name]", "Assignment Table", "forms![assignment
table]![txtserial] = forms![assignment table]![txtserial]")

Any help would be appreciated.
Thanks

Nov 12 '05 #2

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

Similar topics

2
by: yee young han | last post by:
I need a fast data structure and algorithm like below condition. (1) this data structure contain only 10,000 data entry. (2) data structure's one entry is like below typedef struct _DataEntry_...
1
by: david | last post by:
Hi, Gosh I've seen this b4 but I couldn't google it, ah just found it eg search for records having same email address select txtemail,count(txtemail) from `tbl_user` GROUP BY txtemail having ...
6
by: Marlene | last post by:
Hi All I have the following scenario, where I have found all the duplicates in a table, based on an order number and a part number (item).I might have something like this: Order PODate Rec...
33
by: Geoff Jones | last post by:
Hiya I have a DataTable containing thousands of records. Each record has a primary key field called "ID" and another field called "PRODUCT" I want to retrieve the rows that satisy the following...
3
by: AK | last post by:
Hi Our product uses MS-SQL Server 2000. One of our customer has 10 installations with each installation stroring data in its own database. Now the customer wants to consolidate these databases...
7
by: john | last post by:
In my form I have a master table and a details table linked 1xM. I can search through the whole parent table but I also like to be able to search through the child table fields to find parent...
3
by: ryan.paquette | last post by:
In the table there are 2 fields in which I wish to limit (i.e. No Duplicates) Although I do not want to limit them to "No Duplicates" separately. I need them to be limited to "No Duplicates" as...
0
by: cannonpm | last post by:
Greetings and salutations. I have developed an A2K3 MDB and have a search form modeled after Allen Browne's search form (http:// allenbrowne.com/ser-62.html). It works well except for records which...
1
by: tskmjk55 | last post by:
Recently, I have a requirement to develop a vb.net application wherein the input excel sheet data which has an average of 5000 records should be checked for Internal duplicates (duplicates within the...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
agi2029
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,...
0
isladogs
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...
0
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...

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.