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 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:
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
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).
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.
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!
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.)
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?
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?
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.
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
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!
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.
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?
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.
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
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
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.
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.
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".
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
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 = ?
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.
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?