Duplicates, Editing , Dcount

Oct 9, 2004

Hi
I am trying to check for duplication with three fields while entering data.

I have set up a query on the recordsource query and dcount the records
this works in the before update code initially but when editing the record in any field
and moving off the record, I am incorrectly told my once correct entry is now a duplicate.
as though the record compares itself with itself.
ONly if I return its value to empty, move off the record and then reenter the field does it accept it as not duplicated

I'm confused and a little desperate.

thanks

View Replies


ADVERTISEMENT

Modules & VBA :: Using DLookup / DCount To Control Duplicates

Oct 15, 2013

I am trying to put in a control measure which won't allow the user to accidentally add a client to areferral more than once. The simplified relationship structure reads:

tblClient 1-------n tblClientReferral n---------1 tblReferral

I am as a far as using a dlookup which correctly gives the error message, but only if it is the first client added to the tblClientReferral table. If the hypothetical situation arises in which the user adds a client, then adds a second client to the referral and accidentally adds the second clientn twice, the Dlookup is not picking this up.

I suppose the solution is using a dlookup which has the criteria saying if the referralID = 'this' AND the clientID = 'this' Then 'do this'. But as far as I am aware you cannt use AND in the criteria?? atleast, it hasn't worked when I tried. A snippet of the vba code used is below:

Dim objClient As Object
Set objClient = Forms![frmAddClient]![cboClientID]

If (DLookup("clientID", "tblClientReferral", _
"referralID = Forms![frmReferral]![referralID]")) = objClient Then
MsgBox "Client already added"
GoTo ExitSub
Else

View 5 Replies View Related

Forms :: Finding Duplicates - DCount Not Providing Expected Results

Mar 8, 2013

I've been working on trying to get this code to work as expected for days. I'm trying to find duplicates (I can't use primary keys or indexes alone to weed out duplicates due to the structure of the tables involved) in a subform as a user enters data. As soon as a project number is added, the code is supposed to count the number of records that contain that particular project number as well as a category number (there can be multiples of the same project numbers as long as their category numbers are different). This is the code I am using in the "Before Update" event of the field in the subform:

Private Sub ProjectID_BeforeUpdate(Cancel As Integer)

Dim strCriteria As String
Dim RecCount As Integer
strCriteria = "([ProjectID] = " & Me.ProjectID & ") AND ([CatID] = " & Me.CatID & ")"
RecCount = DCount("[ProjHrsID]", "tblProjHrs", strCriteria)

[Code] .....

What could I be doing wrong? Nothing about this code seems to work properly - even the Undo and Cancel=True is a problem (I get the "No current record" error).

View 2 Replies View Related

Find Duplicates And Create Table With Dates Of Duplicates

Feb 12, 2008

Hi this is my first post... so hi all :)

ok what i have is a table with contact details 900k plus

there are about 90k of which are duplicates.

this is the basic feilds that are important in this case.

Id, data_source, data_recived, data_code,

what i want is to have a table with unique records (no dups in data_code)

this table will look like this...

Id, data_code, Num_dups, dup1_source, dup1_date, daysbtw_Dup1_dup2, dup2_source, dup2_date, daysbtw_Dup2_dup3 ,dup3_source, dup3_date, daysbtw_Dup3_dup4 ,dup4_source, dup4_date,

I know there is no more than 4 dups of each record.

what i want from this is a table that will give me a record of how many dups for each record then all the dates that they were added and the date between each record entry.

if anyone can help it would be great .

thanks in advance.

View 6 Replies View Related

Find Duplicates Different Than Duplicates Deleted

Dec 8, 2005

Hey, all! Thanks for helping, here is my situation.

I have a table with about 70,000 records that have duplicate Address field values. The rest of the field values for those records are different. When I do a find duplicate querry I get the result that 17,000 records have the same address. However, when I do the append qurrey as instructed here: http://support.microsoft.com/?kbid=209183 I get a total of only 600 records in the new table. I have tried deleting all of the indexes for both the new and old table, with no luck.

I'm using Access 2000 on XP Pro.

If anyone could help with this I would greatly appreciate it!

Thanks

Will

View 14 Replies View Related

Changing From Duplicates OK To No Duplicates

Nov 1, 2014

I have an Access table with an indexed key that is currently set to duplicates OK. There are not supposed to be any duplicates in that field. But it is possible than a small number have crept through.

Two questions:

1. What would happen to those duplicate records if I changed the setting from duplicates OK to no duplicates?

2. Is there any way to ferret out those duplicate records first and change them manually? The table currently has 48000 records so it would be a pain to go through them page by page. (I know how to export them to Excel, where the dups can easily be found; I was just wondering if something could do it within Access.)

View 2 Replies View Related

Editing When Used By Others

Jan 23, 2007

Hello,

I've got a somewhat urgent question;

When i'm editing in my database other users can't open the database and when they have the database open i can't edit it.

Is there a possability where i can make it possible to enable me to edit while others are viewing, something like a developers database and a user database that update eachother?

View 2 Replies View Related

More On Editing Db And VSS?

Jan 26, 2005

Hi there,

We have a 2003 ms access db that has multiple users 24 hours a day. There are two developers and changes being made all the time to the front end which is on a server.



The ONLY reason we need visual source safe (IF AT ALL...see below) is to be able to make changes even though not in it exclusively. We used to be able to do this with access 97 but not since we upgraded. We get the message: you do not have exclusive access to the database at this time. If you proceed to make chagnes, you may not be able to save them later"



And we never can even if someone is not even in that particular form.



It says: use microsoft visual sourcesafe add-in for microsoft office access"



Is this JUST an addin or do I need the software? I'm not sure what to do and I don't think we need all of the features of the full version.



Could someone advise the best way or where to get what we need?



thanks

View 3 Replies View Related

Problems Editing Mdb

May 11, 2005

Evening all,

I used to program access db's many years ago but it seems that I have forgotten my stuff and need some help.

I have 2 mdb's. One labelled client and one labelled server. They have been copied from an old workgroup network onto a new domain environment, but the problem was the plonker that moved the data did not think about the impact of the database.

Problem I have is when I open the client mdb now, I get the front form but none of the buttons work because it is looking for a network path for the server.mdb which doesn't exist. To add to this I don't know how I can edit the client mdb with the new network path as it removes the bar at the top so that I can't switch into desgin view etc.

Can anyone help?

Thanks in advance,
Abbos

View 8 Replies View Related

Editing Report

Aug 5, 2005

how do i edit a report

i'm new to access

i'm working with this database that will output a report(letter in word document) when the user clicks on a command button
i'd like to edit the letter but i don't know where it's stored.
could someone please show me how to access the report

thanks

View 4 Replies View Related

Editing After FE/BE Split

Nov 21, 2006

I created a database a while back. It was complete to my standards at the time. I split it FE and BE to protect the data.

Since then, I have made several changes on my machine to the user interface and some of the back end tables and queries.

How do I insure that these changes are seen on all the different computers on my network?

They only seem to exist on my personal machine.

View 2 Replies View Related

Problem Editing

Jun 17, 2005

i created a database to place in order my movies collection with 4 fields in a form. the problem is that when i use the form, and accidently change a record and after that i exit the database, it saves the changes. i would like to know what i can do so it won't keep the changes except if i press the save button on the form and also allow me to add more records ( i tried to lock the field but after that i couldn't add any records...). i am not much of access user so please be as descriptive as possible.thank you all!

View 5 Replies View Related

Editing A Calculation

Sep 28, 2005

I have a form that calculates the total cost. It also as an option to revoke the transaction. The code used is below:

=DSum("Cost","tblTransactions","OrderID = " & [ID] & " AND Revoked = False")

I have since added in the option to Discount a product. It writes back to the same table but I can not work out how to edit the code so it calculates the sum correctly.

New fields on table:

Discounted – Yes/No
Discount – Number

I have used this method before:

Cost*(100-[Discount])/100

But how do I put it all together so I get the correct calculation.

View 1 Replies View Related

Form For Editing Only

Mar 24, 2006

I set my form in Design view to Allow Edits but not Additions, and when I switch it to (or open it in) Form view, all the combo and text boxes and buttons disappear (the background color and header are all that's left).

All I want to do is edit existing records through the combo boxes. How can I correct this?

View 4 Replies View Related

Subforms Editing Help

Sep 6, 2006

Okay, I am ready to throw this database out the window but I am so close to being done that I want to see it through to the end so I guess I will continue plugging away at it.

I have a Contractors form and Contractors subform. I have made the allow edits, allow deletions and allow additions set to no for both forms. I made a command button for editing the forms. In the command button I made the onclick event to me.allowedits =False and it works great for my main form but it isn't working for my subform. I am still unable to edit my subform.

I have searched this forum too and found people with the same problem and have tried some of the suggestions but I am still not able to do it. I have attached my database for you to look at and hopefully you can shed some light on it for me.

Thanks

Tracy

View 3 Replies View Related

Editing Menus

Nov 16, 2004

hello everybody
I've created 2 menus using macros and everything works perfectly.
The 2nd menu has 2 commands and I want the second command of the menu to be "activated" only if a specific form is open.Otherwise the command must be in the menu, but not enabled. I also want to put a line between these 2 commands. Is it possible? Thanks in advance

View 3 Replies View Related

Editing A Table

Apr 2, 2008

I am using a form with command buttons to allow an administrator with limited Access knowledge to update certain tables. This is usually done by opening a form that is linked to the table and allow for changes. For one particular table, I would like the Administrator to be able to make the changes directly in the table. I would like for them to access the table with a command button. Here is the code I am using to update the table through the form. How do I need to change it to open the table and not the form. I tried changing the DoCmd to OpenTable and changed the stDocName to "tblStaff" but I received a compile error.

Your help is appreciated.

Private Sub cmdPermission_Click()
On Error GoTo Err_cmdPermission_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmStaff"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdPermission_Click:
Exit Sub

Err_cmdPermission_Click:
MsgBox Err.Description
Resume Exit_cmdPermission_Click

End Sub

View 5 Replies View Related

DCount Help

Feb 18, 2006

Was wondering if someone could possibly help me with a DCount problem i'm having.

I have a form with a subform, displaying bookings that customer has made. What i want to be able to do, is when a booking is created for a customer in this subform, after the time period chosen is selected, i want a DCount to run, go to a table of regular bookings, count up how many bookings in it have the date of booking, that same as the date just put into the subform, AND the time period of booking the same as just put into the subform. There can only be 1 result at max due to its setup, and from there it should be fine, but i cannot get it to work. The field names are as follow:

Subform:
Date for Booking
Time Period

tblRegularBookings
Date For
Time Period

If this doesn't make any sense i can try and explain better.

Can anyone help me?

Thanks very much in advance

View 1 Replies View Related

Dcount?

Aug 8, 2006

I have only been using access for about 3 weeks now, and its kicking my butt pretty hard.

Im making a query that does all kinds of math junk in it. I want to be able to find the number of occurrences of x in another column in the table.

For a better example, lets say I have a column named "SP" in the "compiled" table, the values of this column range from 1 to 5, in about 200 entries. So there is another column in the compiled table called "SPX", which has the same value range. So if I am looking at the one entry in the table, I want to take its value in the "SPX" column, and see how many times it shows up in the "SP" column.

I have been trying to get dcount to do this, but I cant seem to get it to work... Must have tried a dozen ways now.

Any help would be awesome, thank you.

View 7 Replies View Related

Dcount

Mar 26, 2007

My main table is called NEWcompiled, I have fields named "faction", "SPeffect", and "Launcher_ID". I am trying to use Dcount in a query to count up how many entries have a value in "faction" and "SPeffect" that are equal, and a value of "yes" in "Launcher_ID".

Currently my code looks like this:
DCount("Faction","NEWcompiled","Faction = '" & [SPEffect] & "'" And "Launcher_ID = yes")

This indeed counts how many entries have equal values for "faction" and "SPeffect", but then it seems to add that to sum of all the entries that have a yes for "Launcher_id".

Any help would be great, thank you for your time.

View 14 Replies View Related

DCount Help

Feb 26, 2008

dear all,

i have the problem when using dcount in my query,anyone can help me?this is the situation.

Table 1:

Num

20080207
20080215
20080218

Table 2:

Begin End

20080206 20080208
20080200 200802116


i want to make the query,and i want to add field "sumactive" using the dcount function refer to Table 1,anyone can help me?i want to count how many record "num" in table 1,between field "begin" and field "end" in table 2

Begin End sumactive

20080206 20080208 1
20080200 20080216 2

thanks

regards

martell

View 1 Replies View Related

DCount

Feb 28, 2006

Im trying to count the number of records in a table that contain certain crieria, I think I should be using the DCount function and have looked for help on it, but I dont understand it. im unsure if I should be counting the records on the form or the table.

This is my Criteria, Table Name = Armour_Selection, Field name = ExerciseName, I want it to tell me how many records there are with ExerciseName = ?

Could some help please?

View 8 Replies View Related

Dcount()

Apr 3, 2006

I've looked at numerous threads on this site and still can't get a dcount to work.

I want the database to check if there is a valid reference number entered before opening a form.

There is a table called 'staff' with a 'payroll number' field in it. This table contains all staff.

I then want the user to enter a payroll number and retrieve the corresponding record. However, if there is no match then the user has entered the number incorrectly.

I've done:

int2=dcount("[payroll number]","staff",forms!control,payroll) and then an:

if int2=0 then msgbox
end if
exit sub

However, I either now get a message when the number is correct, or it's exitting the sub every time.

Any corrections please?

View 2 Replies View Related

DCount

May 3, 2006

Hi

Can anyone see what I have done incorrctly as this does not work!

Thanks in advance.....

=DCount("[call type]","qryISAHistoryCount","[Label] = 'Call'" And "[User] = 'Craig'")

View 1 Replies View Related

DCount

Jan 5, 2005

are there any restrictions for using Dcount?
i used DCount once in a report, and it works fine. but in another
report it returns an error.. another question.. can i use DCount on calculated
fields in a query?

View 1 Replies View Related

Editing Combo Boxes

Jul 27, 2005

Is there a way to edit combo boxes? I'm trying to add a null value to a combo box.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved