I would like to execute a code to remove the duplications in the MS Access Query but keeping one one data of the duplications.
For example, in the below data, I want to check for the data in the column Part No. The part number 123 and 234 are repeated twice so I want to delete the part no 123 and 234 that repeated second time and keeping the one data.
I have the surname, address1, City & Phone number Indexed(Duplicates ok) but if the combination of all 4 fields match then I want this to be not allowed. I guess maybe I should make the primary key the combination of all 4 fields, not sure how to do that though. Hope this makes sense.
Hi all In my client data entry form i have a key field clientid if a duplicate id is entered it allows the whole form to be completed and wipes entire form on exit, this is ok but how can i get an error message to warn about the duplication of id. Thanks Dave
On our database, we have a form that has 2 calendars. A start date and an End Date. The users fill in the name, and a couple other fields. Then select the start date, and end dates.
When they hit submit, the form enters into the table this info for each date in-between the start and end dates. For example if the users enters they will be taking vacation, then they enter 8/1 as a start and 8/10 as a end date. It will make an entry for each day. This works pretty well for us.
But I would like to improve it if possible.
Let say, a user a month ago made an entry that they would be work 8/23 at home. So in the database it has 8/23 at home.
Well, this week they decide they are going to take a vacation 8/21-8/25. So they make the new entry with start date 8/21 and end date 8/25. The form enters all the info just fine.
But if someone runs a report they see 8/23 at home, and also 8/21, 8/22, 8/23 ect on vacation. So gets a little confusing to where they actually are
So I was wondering if there is a way, for the database to prompt the person making the entry, that there is already an entry for 8/23 and ask if they want to delete it or save it? Then continue on creating the entries for the rest (8/24 and 8/25 in this example?).
Has anyone seen something like this? I was going to search, but not really sure what to search for on the forum.
Hello, I am suing an append query to append new tables to an existing table. However, I only want to append the records that are not in the existing table. I have three variables: Category, Group, Project. None of them are unique. How to wirte this query.
For example: In existing Table:
Category Group Project A 1 Pro1 A 1 Pro2 A 2 Pro1 B 1 Pro1 B 2 Pro1
Now I have two records:
A 1 Pro3 A 1 Pro1
I only want to append A 1 Pro3 to the existing table.
I have a form with information on it relating to several linked tables. I would like this information to be duplicated in the tables and a new autonumber assigned.
Is there a way that I can do this by clicking one button and the autonumber will automatically generate a new number keeping the rest of the information in the form and updating the tables with a new record?.
is there a way that I can compare the ID number from a combo box selection and a table... in order to avoid duplicating that same entry?
ie If me.cbo1.column(0) = [table name].[field] then me.cbo1.column(0) and me.cbo1.column(1), etc... = vbWhite
End if
What I am ultimatly trying to accomplish is a way to get rid of one selection in a combo box after it has been selected once and used for another record. is the .requery a better method... if it is, can someone please elaborate on how to use that a little more.
Table one - tblContent Table two - tblConentImport
I have built a select query that will identify all records that from the tblConentImport table that do not already exist on the tblContent table.
Here is the SQL - SELECT [tblConentImport].[ID], [tblConentImport].[LoginName], [tblConentImport].[Title], [tblConentImport].[Type], [tblConentImport].[Code], [tblConentImport].[Date Assigned], [tblConentImport].[Date Started], [tblConentImport].[Last Accessed], [tblConentImport].[Progress], [tblConentImport].[Date Completed], [tblConentImport].[Time Spent (min)], [tblConentImport].[Score], [tblConentImport].[Result] FROM tblConentImport LEFT JOIN tblContent ON ([tblConentImport].[Code]=[tblContent].[Code]) AND ([tblConentImport].[Type]=[tblContent].[Type]) AND ([tblConentImport].[Title]=[tblContent].[Title]) AND ([tblConentImport].[LoginName]=[tblContent].[LoginName]) WHERE ((([tblContent].[LoginName]) Is Null) And (([tblContent].[Title]) Is Null) And (([tblContent].[Type]) Is Null) And (([tblContent].[Code]) Is Null));
I then built an append qry that appends the new records to the tblContent table.
Her is the SQL -
INSERT INTO tblContent SELECT [qrySelectContentTable].[LoginName] AS LoginName, [qrySelectContentTable].[Title] AS Title, [qrySelectContentTable].[Type] AS Type, [qrySelectContentTable].[Code] AS Code, [qrySelectContentTable].[Date Assigned] AS [Date Assigned], [qrySelectContentTable].[Date Started] AS [Date Started], [qrySelectContentTable].[Last Accessed] AS [Last Accessed], [qrySelectContentTable].[Progress] AS Progress, [qrySelectContentTable].[Date Completed] AS [Date Completed], [qrySelectContentTable].[Time Spent (min)] AS [Time Spent (min)], [qrySelectContentTable].[Score] AS Score, [qrySelectContentTable].[Result] AS Result FROM qrySelectContentTable;
This works great as long as the [tblContent].[type] is not equal to "Class".
This select query and append query have not created duplicate records in my tblContent
Please help me. I'm loosing my mind. Below is the address to view this database. The select qry is named - qrySelectContentTable. The append qry is named qryAppend Content Table.
http://briefcase.yahoo.com/turnerbkgabrobins
Any help you can provide will be greatly appreciated.
So I have a list of records in a continuous form. Within that record is a checkbox called GRT. GRT stands for Gross Receipts Tax, when it is checked I have an after update event that adds a new auto-generated record for the GRT entry. The new record copies the date from the origional record, calculates GRT from the origional records amount field and some other things like that to create the new record. Creating the GRT record entry has went well.
But, if the user removes the GRT checkbox from, or deletes the origional record, I need to delete the corresponding auto-created GRT record. I thought I could do this by simply grabbing the origional records ID and copying it into the auto-generated records field called "AssociatedID".
Problem is, when I reference the origional records record ID, it always comed in as "-1". I can display the ID on the form and it shows correct, but if I msgbox the records ID, it shows as "-1". I cannot figure out how to capture the origional records ID so I can insert it into the new auto-generated record so the two records are linked so I can later use that link to delete the proper associated record.
I maintain a large database of employees. I have a form with a combo box (cmb_department) which I can use to select a particular department. I have written an After Update event procedure which updates the relevant fields on the form after I've selected a department - e.g. their new manager's name, phone number, etc. based on my departments table.
Here is my code, which works well:
Private Sub cmb_department_AfterUpdate() If (Me.is_leaver = "" Or IsNull(Me.is_leaver)) And (Not IsNull(Me.employee_number)) Then MsgBox "This member of staff is an internal HEY employee. Their departmental details will not change to that of the department, however they can still be set up with GP Browser access."
[Code] ....
However, I'd like to do two things which I'm currently unable to get working...
1. If I delete the department name from the box, or select a NULL value, I get a VBA error - run time error 94, invalid use of Null. I will sometimes want to select a Null value to "unassign" a person from this particular type of department but I'd like a way of selecting a Null value and having it simply set to Null which if the form's default value for this field.
2. As you can see I have a MsgBox which checks to ensure you want to overwrite the existing data for the member of staff. If I select Yes then it overwrites. If I select No I'd like for it to set the value of cmb_department back to the PREVIOUS value. At the moment my script sets it to NULL which doesn't really work - for example, say someone is currently set to the Sales department, and I accidentally click to change them to the Warehouse department, I'd like clicking "No" to revert them back to Sales...
I have posted this question twice but i did not get any promissing response that could made my day.
I have a Database with one table. The database has a two forms. One is called Header Form Having following fields: ClassNo, RollNo, Grade, Name. and the other form is DETAIL form having following fields: Month, Year, Subjects, Percentage, Result
Now it works this way. The user first enters data to HEADER form and presses a button that saves the HEADER information to the table then it takes the user to DETAIL form which shows all the fields(Non Modified) from HEADER of the record entered most recently and DETAIL form fields. Basically the DETAIL form is comprised on main(HEADER) and subform(DETAIL).
Now my problem is that when i enter particulars to the HEADER Form and press the button to jump to DETAIL form it works fine. on DETAIL form when i add a record and move the cursor to the next record it also accepts all the data entered on DETAIL form. But when i look at the data stored in table it gives me duplicate entries. I have set the form DUPLICATE on a query which returns non duplicate values. If i enter one DETAIL Item it shows no duplication but when i add more that one record to DETAIL it shows min 2 records with same ClassNo.
Here how my table looks like Record No 1: ClassNo, RollNo, Grade, Name. 01 10 9 john
Month, Year, Subjects, Percentage, Result Nov 99 Maths 76 Pass
Record No 2: ClassNo, RollNo, Grade, Name. 01
Month, Year, Subjects, Percentage, Result Mar 99 Chemistry 87 Pass
My form is not putting the Header data on any record after second. It only puts ClassNo field in each child record. Please Help Me with this and thanks for your patience for reading my problem. I hope someone will give me a chance to say thanks.
i have a table called tbl1. in this table i have field month, year, or trainee. is it possible that above mentioned three field found same data table automatically delte those rows. so i found only unique data. or their is another way to make this possible.
Everytime I change the picture of an image, a duplicate is made. I can see this in the "Insert Image" menu. It this moment, I have over 6000 duplicates which slow my form down alot. I know that you can delete these duplicates by accessing the system tables, but is there a way to stop this automatic duplication? An example is a button that makes an arrow change direction. Every time you click the button, a duplicate of the picture gets saved.
How can I enable a user to click a thumbnail image or other object on a form that will open the bigger orginal image file in a separate browser window (or other photo viewer)?
In A2010 I maintain a database originally created in A2003. The original version was locked down tight. In A2010 I struggled to do the same but got there in the end, as well as allowing me a back door way in.
Now I have an unexpected problem - in the object browser (or whatever it's called) on the left hand side I can no longer copy any object. EG, I want to copy a form for safe keeping while I edit the original.
I concatenated 2 fields CR_Numbers: = CR_Number & [Sub Number] to display 12.01: from 12 and 1. I am now wanting to lookup the CR_Numbers to edit or add information into other fields.
I want to use a pop up form to edit/add data without having the form add an entire row to the table. How do I reference the Table ID so that it will go to the equivalent row to add the data in?
Main Table = Change Request Email Table = AORB_Email Fields in Form!AORB_EMail: Change Request (CR_Numbers), Priority (Pri_Name), Hours (Hour)
I plan on using the Priority and Hours in the email to set some dates and expiration times as well as in the subject of the email. I have figured out the email setup, and if I manually fill in the Priority and Hours fields everything works as it should.
I am a newbie. I am building mutiple tables/queries in one form. I got it to work but it is duplicating records where a name appears more than once. How can I stop this.
I've been trying to use some code I've found to prevent a user from entering a duplicate ID. I've tried this:
Dim Answer As Variant Answer = DLookup("[SAR_ID]", "Request", "[SAR_ID] = '" & Me.SAR_ID & "'") If Not IsNull(Answer) Then MsgBox "Duplicate SAR ID Found" & vbCrLf & "Please enter again.", vbCritical + vbOKOnly + vbDefaultButton1, "Duplicate"
Cancel = True Me.SAR_ID.Undo Else: End If
but it displays the message even if I don't enter a duplicate.
Once you open the db. open up the frmQuoteLog and the frmPDMontior. You will notice one record is displayed in the frmPDMonitor (Justin Ryan). This is correct.Now to test out the issue leave open the frmPDMonitor and frmQuoteLog at the same time. Go to frmQuotLog, go to the first record, make the "Sales Coordinator" = "Chris April", then check the box that says "Display on Product Design Monitor", then press the "Save Changes" button.
Then look at the frmPDMonitor and you will notice the new record is now displayed on the form. This is correct as well.Leaving open both forms, go to frmQuoteLog and uncheck the box you previous checked on the first record, then press "Save Changes".
Then look again at the frmPDMontior and notice that the previous record is gone but the remaining record is now duplicated.Only when I close the frmPDMonitor and reopen it, does the duplication go away.How can I avoid this duplication without closing and reopening the frmPDMonitor? The purpose of this form is to be ran 24/7.
1. Persons (list of persons) 2. Job history (list of jobs)
each person have their own job history. all these jobs are stored in the job history table. when i delete a person i would like the job history for this person deleted as well. each job stored in the job table have a field with person name, so that it is linked to this person.
how can i do this? vba or simple properties options?
Hi I have some drop downs on my form, which has some code that decides which recordsource to use. When I first select an option from the drop down, the query takes 10 seconds to load data. I then select another option, which runs a different query, which takes x seconds. If I then select the original option from the dropdown, the data loads onto the form in less than a second.
Why is there a delay the first time round and not the next? Has Access saved some kind of query plan? If so, why doesn't it save it permanently?