General :: How To Create Relationship With Duplicate Records
Mar 21, 2014
See attached picture where I am stuck at?
I have a table that holds UK Postcodes and a customer table that holds customers.
I am trying to create a relationship between the 2 so when I enter a postcode in the customer table this is then related to the postcode table.
The main problem I have is that there is a lot of duplicate postcodes in postcode table so the primary key is simply a number as you will see in the picture.
View Replies
ADVERTISEMENT
Mar 22, 2015
I have created a linked Excel table in Access 2010 called 'tblExcelLinked' and I have a form called 'ASB Log Form' for the purposes of presenting the data in a more readable manner that is easier to view, plus link other fields of data that are not directly related to the 'tblExcelLinked'.
Because there is no unique ID in the 'tblExcelLinked' to create a relationship, I have created a table called 'tblASB', which allows me to add other table data linked from same d/b.
I now want to update the 'tblASB' with data from the 'tblExcelLinked', but only append new records from 'tblExcelLinked', but my inadequate append query is duplicating the records each time I run it, rather than just adding the new ones.
Once sorted my next challenge is a macro so that this runs automatically rather than being manually triggered.
View 3 Replies
View Related
Aug 1, 2013
I have the following tables in my Access database.
A < B < C < D
(The "<" represents a one to many relationship.)A given row in table A can have up to 4 children (stages) in table B (stages 1 to 4).The other one to many relationships do not have any limitations as far as the number of children are concerned.All tables have AutoNumber primary keys.When the user clicks a button in a form, I want to:
Copy all data in the current stage (current row) in table B (corresponding to a given parent row in table A), to the next stage in table B.All data in child tables must be included in the copy process.In other words, for a given row in table A, by use of buttons in the forms for each of the stages 1 3, the user shall be able to do the following:
all data for stage 1 are copied to stage 2 (for user modification), then
all data for stage 2 are copied to stage 3 (for user modification), then
all data for stage 3 are copied to stage 4
Is it possible to do this in Access 2010?
View 4 Replies
View Related
Nov 20, 2013
I am working with a sub-form where once a staff member enters there sub measure I would want to create a duplicate of that record. The problem I am having is that once you enter the sub-form and click the duplicate button it creates a duplicate of the record selected but overwrites the first record in the table. I want it to create a new SubMeasure Number which is the primary key and assigns the record the next available number.
Also if I try to add another record after one has been added I get runtime error "3021" - No current record. I would have to close the form and reopen for it to be able to add again.
I have attached the code below:
Private Sub cmdDuplicate_Click()Dim dbs As DAO.Database, Rst As DAO.Recordset
Dim F As Form
'Return Database variable pointing to current database
Set dbs = CurrentDb
Set Rst = Me.RecordsetClone
[code]....
View 4 Replies
View Related
Jun 27, 2014
I have almost no experience of VBA outside of working a little with codes generated for me like docmd etc.
I am trying to create a database for resourcing staff.
I have a form where the user inputs a start date and an end date which updates a table.
I have a query that works out the number of working days between those dates.
I have a table with all the working dates between now and 2016
I want to put a duplicate record button on the form (I can do that bit)
The tricky part is I want it to create a new record for each date in the dates table between the start and end dates.
Example 23/06/2014-18/07/2014 = 20 working days. I want to end up with 20 records with start dates as below and the same end date.
23/06/2014, 24/06/2014,25/06/2014,26/06/2014,27/06/2014,30/06/2014,01/07/2014,02/07/2014,03/07/2014,04/06/2014,07/07/2014 etc up to 18/07
View 9 Replies
View Related
Sep 2, 2013
I am trying to create a duplicate of a certain record in a table so that the user can then edit the new record - or old record even as it doesn't matter - as long as one of them is original. The idea is that any revisions / changes are stored the user may of made.
View 2 Replies
View Related
Jun 13, 2013
I have a code that works great from the parent form but I decided to change the format and call it from a lostfocus event in the subform instead. Now I keep getting error 3314:"You must enter a value in the tbGuests.LastName field".
The code should copy the parent form fields and create x number of duplicate records according to a field on sub-form. It then runs an append query to add the information from the subform.
Code:
Private Sub GuestsInParty_LostFocus()
Dim partymsg As Integer
Dim dbs As dao.Database, rst As dao.Recordset
Dim F As Form
Dim intHowMany As Integer
Dim intCounter As Integer
[code]....
View 1 Replies
View Related
Apr 8, 2014
I have a database with customers/orders etc. I need to create a form or something which will show if a duplicate customer is entered. I know about the duplicate records query wizard, but I also need an easy way to consolidate and delete records. When a duplicate customer is found, move the customers order/s [OrderNumber] to the existing customer and delete the new/latest customer record.
Customers are in tblCustomers, their orders are in tblCustomerOrders, [CustomerNumber] is the joining field.
I was thinking of just a date/time field for [DateCustomerEntered] with default value Now to keep track of the later customers?
View 7 Replies
View Related
Aug 28, 2014
Users are too lazy to check whether a patient record exists or not. Consequently, we have a number of duplicate records that I would like to merge.
My problem is finding a way of linking 2 subforms to a parent that is not based upon a query.
On the parent form, I want two Comboboxes called 'Patient_to_Keep' and 'Patient_to_Discard'.
The two subforms called Frm_DUP_Patient1 and Frm_DUP_Patient2 should then display the data of the respective combo boxes.
Once I have this working, I can write the necessary code to compare and update the data as required.
View 5 Replies
View Related
Jun 19, 2012
I have three tables:
tblClient (for basic client information),
tblDischarge (for client discharge information), and
tblAppointments (for appointments that are added to an outlook calender).
All three tables are linked using the IDNumber from the Client table. I have a form where a user inputs a discharge date for the client.
Once that date has been added I need to add 5 records to the Appointments table for different followup times based on that discharge date (such as one month, two months, three months, etc.).
I have the code working to add an individual appointment to outlook but not 5 different ones at one time. So the question I have is how to add the 5 records based on the one discharge date?
View 1 Replies
View Related
Apr 8, 2015
I know this has probably been gone over, but I'm just looking for a super-simple way to put a button on my form that will create a number of records equal to the number of days in the month listed in a field. For instance, if MyField is "4/1/2015", I'd like the system to create one record for each date between 4/1/15 and 4/30/15.
I have scoured the forums, and I find many threads on creating multiple records, but none of them deal with the same type of thing I need. I have a field, called MyField, and I have a table called MyTable with a column called MyDate. I want to enter a date into MyField, then click a button, and the button will run code/macro/whatever that will create multiple rows in MyTable, one for each date in Month([MyField])
View 8 Replies
View Related
Dec 17, 2013
We have a database with PROPERTY_ID and DATE and COSTS
The database is sequential and complete up to some point in time but some records stop short of a current date. (The DATE is represented by months)...
#1 #2
01/31/2013 10/31/2013
02/28/2013 11/30/2013
03/31/2013
Some records go thru 2012 and some to current date of NOV 2013.
To normalize the data we need to create blank records for each PROPERTY_ID thru Nov 2013 beginning with the last record for the PROPERTY_ID.
For the example we need to create APRIL thru NOV 2013 for PROPERTY_ID #1
View 10 Replies
View Related
Jul 1, 2015
I want to create a database that keeps track of contributions of members of an association. Every member can voluntarily give a standing order to contribute a fixed amount every month. A member can as well decide to review his/her contribute.
how I can come up with a database that can automatically add the contribution of a member monthly without manual input since the stated contribution is known. So that I can run a report for individual member and the report can capture the every monthly contribution that has been added automatically and shows when ever a member changes his/her contribution amount.
View 1 Replies
View Related
Dec 4, 2013
I know my way around Access reasonably well but am by no means an expert. I have created a system that I use in my business for hardware/software requests, and was told to do it in Access. I did ask that we do it on SQL Server with a Web Front End, but we are where we are.
Now, I have been on a SQL query training course so I know the basics, but am a bit confused on this one since Access has been added to the mix.To make matters more frightening, this is Access 2003!
My tables are as follows:
[T_Request]
AT Reference (primary key, autonumber)
Forename
Surname
UserID, etc etc
[T_Hardwarelist]
ID (primary key, autonumber)
Make
Model
Description
[T_UserHardware]
AT Reference
ID
[Request] is inner joined to [UserHardware] on the AT Reference column.
[UserHardware] is inner joined to [Hardwarelist] on the ID column.
The select query I have is basic and does just what it says on the tin; it shows who has what hardware.The query:
Code:
SELECT T_UserHardware.[AT Reference], T_UserHardware.ID, T_HardwareList.Make, T_HardwareList.Model, T_HardwareList.Type, T_HardwareList.Description
FROM (T_Requests INNER JOIN T_UserHardware ON T_Requests.[AT Reference] = T_UserHardware.[AT Reference]) INNER JOIN T_HardwareList ON T_UserHardware.ID = T_HardwareList.ID
WHERE (((T_UserHardware.[AT Reference])=[Forms]![F_Request]![AT Reference]));
However, when it comes to adding NEW hardware to the requestI have a form called F_Request.I have a sub form called SF_Hardware.The SF_ Hardware subform runs the aforementioned query, and shows what hardware is assigned to the parent request.If I add new hardware via a dropdown on the form, it adds it in to [T_UserHardware], but it also adds another value on the [T_Hardwarelist] table. E.g. if I add a "HP Compaq 8200 Elite" (which is stored in [T_Hardwarelist]) it adds it to the [T_UserHardware] table correctly, but creates a second (third, fourth, fifth) entry on the [T_Hardwarelist] table for the same kit.
I think its confusing because of using a select query and might have to run a 2nd query on save or something like that, I had a working version before that had the make, model etc in both tables and didn't have a 3-way relationship. It'd be nice to have the request table with the high level info, a hardwarelist table with our catalog of kit, and a userhardware table just containing the ID and Reference for the hardware/request rather than duplicating the information.
View 2 Replies
View Related
Jul 10, 2012
I think what I want is:
1 table(1): record of people & contact details
1 table(2): list of events with check box's with the names of people from the other table
1 report: listing how many events people have attended.
When I add a new person to table 1 I want a field to be added to table 2 in the form of a checkbox, also when I delete this person I want this field to be deleted in table 2.how to make this an automated process.
View 1 Replies
View Related
Sep 14, 2014
I am creating an access database for recording calls and follow ups for a company
relevant tables
mst_customers
card_call
ID from customers and customer_id from card_call have a one to many with all records of card_call
Although its more elaborate than this, lets get down to the problem
I created a form with a subform that should basically allow selection of customer and based on this, the creation of records in card_call as per customer selected. form and subform are linked by customer_id
Everything is working except a peculiar issue where if i select a customer_id it shows all relevant records + an additional record (usually 1 or 2) that just changes the customer_id for that record.
Example
customer_ID = 2 (combobox bound to column1 and showing name/column2)
output
call_ID | Customer_ID
1 | 2
2 | 2
3| 2
changing customer_id to 4 will change to
1 | 4
(new) |
View 1 Replies
View Related
Jun 3, 2013
I would like to create a multi-select list box for all the records in an access 2010 form.
View 2 Replies
View Related
Sep 25, 2006
Structure of db
tables
divs(divid, div, div_short, div_num)
subdivs ( subdivid, divid, subdiv)
issues (issueID, issue, issueName, subdivid)
subIssue1 (subissueID, subissue, issueid)
subIssue2 (subissue2id, subissue2, issueid)
resolution (resID, labeltext, subIssueID)
resolutionlink( resID, labeltext, linktext, navURL, suIssueID)
relationships
div and subdiv (1 to many)
subdiv and issues (1 to many)
issues and subIssue1 (1 to many)
subIssue1 and subIssue2 (1 to many)
Now resolution table could have a one to many relationship with either issue table, subIssue1 table, or subIssue2 table. When I go to create any of those relationships, Access won't allow me. Tells me it can't create this relationship and enforce referential integrity.
Possibly I need to restructure my database to accomodate?
I am not sure, any help would be appreciated.
View 3 Replies
View Related
Dec 7, 2006
Could someone please help me with the following problem.
I have a report that downloads into excel from a loan software program.
The report has lots of data for each individual loan number
What I have done is link this report to access as a table.
The problem I am having is how do I create a relationship with that table.
I want to create a status report that does the following
There are about 15 steps in the loan process, and I want to add 3 fields to link to every loan number (possibly a subform)
description of event
is it completed(y or n)
date completed
can someone please help me with any ideas
thanks
Josh
View 5 Replies
View Related
Jun 4, 2007
I am a newbie to access and i am working on a project that has two tables
the primary table has for example the following fields:
firstnameID(primary key) data type auto number
Firstname data type text
the second table has for example :
LastnameID(primary key) data type auto number
Lastname data type text
FirstnameID (foreign key)data type number
I created a relationship between the FirstnameID in the primary table and the FirstnameID in the second table ..
My problem is this whenever i try to view the relationship when i open the primary table it don't show the relationship ,
The Field FirstnameID in the secondary field is always Empty the only time the relationship is created is when i manually insert the autonumber that is generated in the FirstnameID field , but i thought that since a link was created then that field would have automatically be inseted with data , am i assuming wrong or am i doing somethingn wrong? how do i get the autonumber to be inserted in the field automatically to create the relationship?
Please Help
View 3 Replies
View Related
May 20, 2007
Hi
Im building a web application to control the stock of a small company.
I already made the database with all the items and descriptions in one table.
This table would be the main warehouse. so now i have to create 3 different departments in different tables where i have to move stuff from the main warehouse.
So if i have 10 boxes in main, and i move 4 to department1. then i would get 6 boxes in main and 4 in dep1.
My web app would be constantly updating the stuff being sold in departments 1,2,3.... so here is my question.
how do i make the database to update the quantities by itself in the main warehouse table if department X sells anything...?
Like in Excel, when you work with different sheets that can update the other ones if you change a number. the rows can be linked... can i do this in access?
Otherwise i would have to write a lot of extra SQL code in the ASP scripts and im really out of shape cause i don't program in ASP sisnce very long time ago... years.
Thanks!
View 3 Replies
View Related
Sep 23, 2004
Alright I've been picking my brain for the past hour trying to figure this one out...
I have 3 tables...
1) Retailers-RetailerID, RetailerName, address etc. (500 entries)
2) Distributors- DistributorID, DistName (10 entries)
3) Uses- RetailerID, DistributorID
Sample data is as follows for 'Uses' table:
RetailerID DistributorID
1 1
1 3
2 1
2 6
3 4
3 5
4 8
I am trying to create a search form based on a query which will return retailer information for those retailer who use multiple distributors.
For Example...There will be 2 text boxes and a user can enter a distributorID in these text boxes. If only 1 distributorID is entered, it will display records for that one.
I have tried the following but I have been unsuccessful:
SELECT Uses.RetailerID, Retailers.Address, Count(Uses.RetailerID) AS CountOfDistributorID
FROM Retailers INNER JOIN (Distributor INNER JOIN Uses ON Distributor.DistributorID = Uses.DistributorID) ON Retailers.RetailerID = Uses.RetailerID
WHERE Uses.DistributorID = 1
GROUP BY Uses.RetailerID, Retailers.Address
HAVING Count(Uses.RetailerID) > 1
Is this possible to accomplish with the way I designed this database? If so, can I get a little advice? I know this is a long question that can't be answered in full but I would just need to basics in order to be on my way.
Thanks in advance!
View 1 Replies
View Related
Mar 27, 2014
Is it possible to create a relationship between subform and a table?
View 1 Replies
View Related
Aug 4, 2015
In table 1 fields Factor, Aggregations, Stat, and Days Back are fields that make up a multi-field primary key [URL].
I want to create a relationship between that multi-field primary key and another table, call it table 2, and make it a one-to-one relationship.
How do I do this in MS Access 2013?
View 3 Replies
View Related
Nov 29, 2005
This is a real mind bender.
I am running a2k. I am merging two databases. table1 is in the backend database. table2 is linked to the second database.
I run an append query to add table2 entries to table1. The append fails for 96 recs saying key violation. Turns out I can rerun the append if I drop the zip code field.
I then try to manually change the zip code and receive the duplicate values in index, primary key, or relationship.
I ran a compact & repair the databases, still no go. I can't edit the value of the zip code. I import the table to a new database. Still can't change the zip code. I drop MANY of the indexes. Even the index on the zip code field. Run compact&repair. still getting the index message. I even re-imported to a new db again. Still same error message.
I may start again by importing JUST these two tables to a new blank db and see if I get the same issues. I'll keep you posted...but maybe there is someone out there who has seen this error before.
fyi-if I enter a new record, the autonumber field correctly increments to the next available autonumber field. (I say this because of another thread on this matter w/ autonumber fields and bug in A2003)
View 1 Replies
View Related
Nov 29, 2013
I am trying to create duplicate records from a main form frmManagers which has a subform frmSubMeasure. I have placed the duplicate button on the main form. It creates a duplicate of the main form data and gives me the option to add new record to the sub. I want the duplicate to be created on the sub form for me to just edit the scores.
I don't know how to pass the sub form data to be duplicated I thought the append query which I used would update the tblSubMeasure table which created the subform frmSubMeasure.
In the sub the append query do update the form with the new MeasureID from the mainform and the form is available to enter new data. I want the subform data to be duplicated as well
In the query I included all the fields from the tblSubMeasure table and this is appended to the same table tblSubMeasure and I place a tag on the MeasureID using "[Forms]![frmManagers].[Tag]"
Code:
Private Sub btnDuplicate_Click()
Dim dbs As DAO.Database, Rst As DAO.Recordset
Dim F As Form
'Return Database variable pointing to current database.
Set dbs = CurrentDb
Set Rst = Me.RecordsetClone
[Code] .....
View 1 Replies
View Related