Remove Extra Records

Jan 9, 2007

I have a table t1 which contain many records, the field look like:

id f1 f2 f3 ---fn

Id is the primary key
I have some records which have different id but exact the same other fields.
like
id f1 f2 f3 ---fn
87 1 4 6 ---9
12 1 4 6 ---9
18 1 4 6 ---9
116 1 4 6 ---9
1287 1 4 6 ---9
98787 1 4 6 ---9

for those records, I only want to keep one record (any one) and remove all others. How can I do that?

Thanks.

Jeff

View Replies


ADVERTISEMENT

Trying To Remove Extra Spaces In An Address Field

Apr 20, 2006

I need help. I'm trying to do an update query to delete extra spaces in a field


I want to Change 1234[space][space][space]Elm[space][space] St.

to

1234[space]Elm[space]St.

Thanks,

Vern

View 3 Replies View Related

Opening Forms Extra Records

Aug 31, 2011

When I open my access 2007 database from the switchboard, the form that it opens up to is a parent form with a subform embedded in it. The subform is linked by the 'org name' and by 'year'.

I am finding that when I open the parent form,there is always an additional empty record in the subform, alongside the record which has data in it.

I am not sure why it is doing this, especially as when you enter another record, this empty form vanishes. Its almost acting as the default form?

I have also noticed that when I go to another form which is displaying specific data linked to the 'org name' and 'year' it also has an extra record

However, the weird thing is it does not show up in the table. And again, once you go to a new organisation and input some data, and then go back to the other organisation,the additional record has gone?

Is there a simple property setting whereas each time you open the form, it always opens up to where you essentially left off, no empty record?

View 2 Replies View Related

Between Dates Parameter Query - Extra Records Generated??

Apr 4, 2008

Good Evening Everybody,
I am currently helping some people out at work with their database. My knowledge of Access is very limited, and whilst my it is improving I have nonetheless come up against a ‘hurdle’ which I am struggling to jump. The database in question is not complex, quite the opposite in fact. Basically 1 table ‘Main Data’ , 1 data entry form and a few reports. The table includes 8 fields in the following formats:

ID: Auto Number
Area: Text
Equipment:Text
EquipSrlNo:Text
EquipLocalNo:Text
MOPNo:Number
DateDone:Date/Time
MOPPeriodicity:Text


I was recently asked to produce a report for them that would search between two dates using a parameter query and to then return the result. The problem is that when I generate it using the following SQL it returns records in the period that I asked for, but then collects ‘additional records’ which fall outside the date-span that I originally requested, i.e. search Between 03/04/08 And 30/04/08 produces data that relates to data in May, June, July 08 etc. I thought that what I was doing was correct, and it has worked for me in the past- but on this occasion I am absolutely confused???

SQL
SELECT [Main Data].Area, [Main Data].Equipment, [Main Data].EquipLocalNo, [Main Data].MOPNo, [Main Data].DateDone, [Main Data].EquipSrlNo, IIf([MOPPeriodicity]="1",DateAdd("m",1,[DateDone]),IIf([MOPPeriodicity]="3",DateAdd("m",3,[DateDone]),IIf([MOPPeriodicity]="6",DateAdd("m",6,[DateDone]),IIf([MOPPeriodicity]="WEEKLY",DateAdd("ww",1,[DateDone]))))) AS TestDueNext, [Main Data].MOPPeriodicity
FROM [Main Data]
WHERE ((([Main Data].Area)=[Enter Area Type]) AND ((IIf([MOPPeriodicity]="1",DateAdd("m",1,[DateDone]),IIf([MOPPeriodicity]="3",DateAdd("m",3,[DateDone]),IIf([MOPPeriodicity]="6",DateAdd("m",6,[DateDone]),IIf([MOPPeriodicity]="WEEKLY",DateAdd("ww",1,[DateDone])))))) Between [Enter Date Start] And [Enter DateStop]));

Unfortunately, I do not have a copy of the database in question and so I am unable to post it for the purpose of explanation.

Can some kind person point me in the right direction as I am slowly losing the ‘will to live’ Ha? Ha? You have always been so helpful in the past and hence the reason I have called upon my ‘forum friends’ to help me out?


Look forward to your response(s)


Best Regards

CarolW

View 4 Replies View Related

Forms :: How To Avoid Creating Extra Empty Records In Input Form

Sep 18, 2014

I always have a problem with input forms in Access in that I usually end up with an empty excess record which is being created because I do not know how to program this correctly.

I have a Purchase Order Receipt form (frmPurchase). When I receive a certain quantity of an article associated with a lot number (or a serial number) I have another input form opening up (frmLotorSerial), passing to it through Openargs, the article and the quantity received.

Say we receive 10 units of which we want to register the serial number, I want the user to be able to enter a maximum of 10 units (could be 10 records if each record = 1 serial number, but it could be less than 10 if we have several units per lot number), and not one more, into this frmLotorSerial.

The record looks like this:
-key
-artno (article)
-recqty (quantity received)
-date
-warehouse
-lot number

I used the lost_focus event on lot number to check whether the total received quantity in this form matches the total passed to it from the Purchase form, and if it does to stop the input. Since I could not close the window in the code of this event (error 2585) I moved the close command to the current event of the form.

Doing this closes the form all right, but it always creates one record extra, which of course does not carry any information, apart from the date which has a default value of now.

How should I program/what events should I use to:
-test that the user should not go any further (total received in frmLotorSerial = total received in frmPurchase)
-close the window and, above all, not create this extra record.

View 2 Replies View Related

Remove 1 Set Of Dup Records

Jul 22, 2005

:confused: I am importing a file from excel into access. The table has about 6300 records. Some records are duplicates or even triplicates. How do I write a querie to leave only 1 of of these records and rmove the duplicates.

Second, I will be importing new files weekly that after I do the above I will need to append to the first table and then remove duplicates. How dod I do this.


thanks

View 5 Replies View Related

Remove Duplicate Records

May 1, 2007

Can anyone suggest a way to remove duplicate records.

I've come up with this:
SELECT *, count(*) cnt FROM tableName GROUP BY fieldname1, fieldname2, .... HAVING cnt > 1

But this does not fully resolve my problem.


Thanks.

View 2 Replies View Related

I Need To Remove All Duplicate Records.

Feb 6, 2008

Hi,

I need to remove all duplicate records in a table. These are records that have matching Contract and Order fields. I can't do a DISTINCT query, because that still leaves one record. Thanks.

Michael

View 5 Replies View Related

Add/Remove Records From A List

Jun 2, 2006

(Been a while since I had a question.) I have a table that stores a list of paper forms. the fields are ID#, display name, doccument name, and a code to determine if its a Word or Excel doccument, or an access report. Works fine; the user can click a form name (on the Forms/Reports tab on the main menu form) in a list box, set the # of copies and print the form. There are cases when a group of forms is needed (client admission is one). I have made a group table containing: GrpID, Grp Name, formID. I would like my "Form Group Edit" form to have 2 list boxes; the left one containing the (short) list of available forms; the right one displaying what forms are already (if any) in the selected form group. My idea is to have add/remove controls to manage the right list. I know this "wheel" is already invented and would like to plagerize one that works. Thanks in advance for your help.

View 2 Replies View Related

Remove Null Records From A Query ?

Aug 4, 2005

Hi, I have a query which works perfectly and deletes the unnecessary records according to the criteria i have set , but i dunt want this null values in all column to display in the exported output file. how do i delte the records which are already null .
i tried delete query but it did not work

Please help me

View 1 Replies View Related

Remove Null Records From A Query ?

Aug 4, 2005

Hi, I have a query which works perfectly and deletes the unnecessary records according to the criteria i have set , but i dunt want this null values in all column to display in the exported output file. how do i delete the records which are already null .
i tried delete query but it did not work . This is in microsoft Access.

Please help me

View 3 Replies View Related

Remove Link To Related Records In Form

Jan 23, 2006

I have a Datasheet view of a form and it displays a "+" symbol. When expanded it returns a list of related records. How do I get rid of the "+" in my form?

View 8 Replies View Related

Modules & VBA :: Code To Remove Duplicate Records?

Jun 12, 2014

I have a table which has duplicate records so I want to write down the code so that when the user click on a button then it should remove the duplicate records from the table.

View 2 Replies View Related

Queries :: Remove Duplicate Records From Table

Jun 12, 2014

I have a table which has duplicate records so I want to write down the query that will remove the duplicate records from the table.

View 1 Replies View Related

Queries :: How To Remove Duplicate Records From A Query

Feb 11, 2014

I have this small database, I would like to have your support to setup this query "QryResults" in order to remove the duplicate records, I can't find a way to get shown only true records, for some reason I'm getting duplicate rows and fake values, the query is calculating operations from two different queries and a table.

View 3 Replies View Related

Update Related Records And Remove Duplicates

Mar 18, 2014

I have two tables, one is of departments, and one is of people (with a FK denoting what department this person is in). Now consider the fact that there are duplicates in the departments table, and I would like to remove these duplicates. However, the duplicates have related records (in the people table). So, before removing the duplicates, I must update the FKs in the table of people (this is the step I'm having trouble with).

Here's an example:

As you can see, the "Sales" department is there twice. And both have a related record. What I want to do is:
Update all DepartmentIDs (in tblPeople) to not point to duplicate records. In this example, that would be PersonID 2; Joe. His DepartmentID should update to "1" (as both "1" and "2" are "Sales").Delete the duplicates in tblDepartments (in this case, DepartmentID 2, "Sales").

The second step is no problem, it is only the first I am struggling with.

Also, the example posted here is just an example, the data I actually need to do this for is significantly more complex and there are many more records! In the attached database:

qry1: Simple query to find all duplicates (just used the query wizard)
qry2: Just the first row of each duplicated departments (duplicates that shouldn't be deleted). In the example above, this would be the "2", "Sales" row in the tblDepartments table.
qry3: Basically all qry1 rows that don't appear in qry2
qry4: All qry3 values, and their respective qry2 value.

This is what each of the (soon to be deleted) duplicate values' related records' DepartmentID should be updated to... There's no simpler way to phrase that, so using the example above, qry4 would return "2","1". This indicates that all people with a DepartmentID of "2" should be changed to "1" (so we can subsequently erase the department with the ID of 2.

This is as far as I have gotten. My next step is: Update all FKs in tblPeople based on qry4 (You can't set an update query's criteria to pull from another query, nor can you use the second query for the update value... or maybe you can, but I don't know about it).

View 3 Replies View Related

Remove Specific Type Of Attachment From All Records In Table

Jul 20, 2012

I have table call "empTable" and it has an Attachment field called "Attachment". Some of the records has empty Attachment field and some record has one attachment and some has two and the attachment types are jpeg and pdf.

I want to remove all the pdf from all the records in this table automatically with VBA or something, is it possible? How to do it?

View 3 Replies View Related

Extra Mdb File Created

Jan 1, 2006

Hi All,

For some strange reason, a replica db is being created along side the original. I don't believe it's a back up since the name back_up usually appears in the file name. I've seen it happen once when the proper mdb file was opened and then noticed the new db was created (always called db1.mdb). It's a permanent file mdb file and not the record locking icon. I remember over the summer someone posted a similar problem but I haven't been able to locate that thread. Any suggestions?

Thanks

View 2 Replies View Related

Extra Tools In Access XP

Mar 8, 2008

Although I have been using access for a year or two (self taught) I have only recently noticed that the form toolbox (the one with combo boxes and buttons etc on it) appears to have a library of procedure calls for calendars and all sorts of things sitting there waiting to be used. Is there a list somewhere of what all this lot does? I have been playing with a couple of date pickers but I don't particularly want to go through all of the rest to see what they do or if they would be useful.

Thanks

View 2 Replies View Related

Delete Extra Fields

May 28, 2006

Hi
Does anyone know how to delete the extra blank fields you get at the end of a query. I am converting the query to a handheld database with a field limit and the extra fields push my field count over the limit. i have tried just 'deleting' them but they reapear when I reopen the query. they definitely count as fields because if I delete some real fields i can do the conversion. i dont want to alter the structure of the original database as it has been in use some time and works well. any ideas advice
Thanks
supateach

Hi again
I am still having problems with too many fields in my query so it will not convert to a handheld database. I have tried making a test query (with the wizard)from the same table and sure enough there are extra fields at the end, which do not come from the table, which reappear after they have been deleted, when you reopen the query. I have attatched the query to illustrate that I have deleted the fields and then they reappear. It does appear to be impossible to get rid of them, in which case I shall have to decrease the number of 'real' fields to get below the max the handheld can convert. Any advice gratefully received
Thanks
supateach

View 1 Replies View Related

Wrap Expression In An Extra IIf

Aug 29, 2006

I have the following expression, which needs to be wrapped by some extra logic:IIf([NetTotal]<>0,IIf([NetTotal]-[InvoicesRaised]>0,30,[InvoicesRaised]/[NetTotal]*30),0)What I need to do is, if the above expression comes to less than 0, then the control box needs to display 0, otherwise it should display the value of the expression.Now, I know I can do this by IIf(expression<0, 0, expression). However, this adds a lot of code in there and the expression is put in twice. Is there an alternative way of doing this ?

View 1 Replies View Related

Expression - Extra Filters

Aug 31, 2006

Is it possible to adde extra filters to an expression, i.e. the same as an AND clause in a SQL query.
For example,
=DSum("[1To90]","tableA","ID=2")

I need something like :
=DSum("[1To90]","tableA","ID=2 AND Region='A'")

Will that work ?

View 1 Replies View Related

Is It Possible To Add Extra Fields To Dates?

Dec 3, 2007

Is it possible to have an extra field that is added to the calculated weeks left? Such as what if I want 2 extra weeks instead of the 12?

I know this is probally an advance question! Thanks in advance!!!


This is the awesome example from sbenj69:

Expr1: 12-(datediff("ww",[join date], date())

What I want to do is add another column which will have an additional number. The additional number would just be added to the 12- part of the code. So if I have a field with 2 in it, the 12- would become: 14-(datediff("ww",[join date], date())

Is this truly possible or is it something that can't be done in access

View 5 Replies View Related

Question About Extra Text In Query

May 25, 2006

Hello,

I made an database with all addresses.
When persons live in an appartment, then the field "busnummer" will be filled in with a number. When they live not in an appartment, the field "busnummer" is empty.

In a query, I made an expression and filled the expressien in field (in the query):

Expr3: IIf([Busnummer]>0;"bus [Busnummer]";"")

When "Busnummer" is greater then 0 THEN write the text "bus" and the value of the field right behind, else leave the field empty.

The result of the expression above is:
"bus [Busnummer]"

I have already tried the following:
Expr3: IIf([Busnummer]>0;[Busnummer];"")

The result of the expression is the number I filled in in the database. Now I want to have the result: bus and the number I filled in... :)

Who can give me a tip to solve this problem?


Kindly regards

View 3 Replies View Related

Adding Extra Columns Dynamically

Mar 5, 2007

Hi

I have 120 tables, each with the same name except 2 identifying characters at the end eg pc_dist_ab, pc_dist_al
Each table currentnly has 3 columns.
I would like to be able to add 2 additonal columns to each table with one query and was hoping an alter table query where the table name matches pattern would have worked but evidently not.

Is there a way to build some sort of dynamic query to add extra columns to these different tables at the same time?

To save another post I guess Once this is done I would then like to create 1 main table by creating a new table and appending all the files together- again I would prefer to be able to run this once.

I'd appreciate any help/thoughts as to whether this can be done?:confused:
Thanks

View 1 Replies View Related

Extra Blank Line In Form

May 23, 2006

I have a pop-up form in Continuous Forms mode used to enter notes tied to the id field of my main form.

Two fields - notedate and status. Everytime I click in the blank field "status" another blank record always shows up underneath.

I have "notedate" set to auto fill when the focus is set to "status" and this is creating extra records in my table.

Is there a way to stop this from happening?

"Cycle" set to All Records - changed to Current Record with no difference.


Private Sub status_Click()
If IsNull([notedate]) Then
Me.notedate = date
Me.status.SetFocus
End If
End Sub

Private Sub Form_BeforeInsert(Cancel As Integer)
Me.negid = Forms!OpenContracts!negid
End Sub

Thanks,

Toni

View 4 Replies View Related







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