Tables :: Prevent Adding Records If Already Exists On Another Table
Jan 2, 2013
Table in my access 2010 is configured to have a unique records (no duplicates)which has now records more than 2000 so i copied the table and pasted Structure only. what i would like to have is that new table which presently is empty should not add any record which is already available in old table. While entering data in new table i would like users to see the error if they try to enter the record which was previously entered in old table.
What I have is a database that I have done some tweaking on and in the meantime the original db has been in use which has added around 200 or so more records in the table.
What I would like to do is to just update the db that I have been working on with the older db table(the one who has the additional 200 records).
EX. DB A(Old DB, Newer Table) DB B(New DB, Older Table)
I want to put DB A table into DB B
Is this a simple fix? Or do I need to write some sort of query to update the records in the old table? I've tried to export the excel file and then import but it puts it in unrelated objects and then my switchboard or nothing works.
Okay I had an idea and I thought I might get ffedback as I am relatively new to this. I went through a period a couple of years ago when I used access alot and was becoming familiar with VBA etc but I havent touched it in 2 years so Im pretty rusty.
I am running a study and need to have to create a database that:
a. collects data about participants b. Has a number of questionnaires (5), each of which can be filled out by participants.
THe main table has a number of fields that collects info about the participants the most important of which will be the ParticipantID - an automatically generated number which is my primary key.
In table 2/form 2 I will host questionnaire one. This will be linked to Table 1/Form 1 (Particpant Information) by this tables primary key - also the Participant ID. The relationship will be 1:1. Each participant can only have one Participant ID and will only need to fill out questionnaire one once.
Is it possible that when I add a new participant to the Participant Information table/form I also automatically create a record in Table 2/Form 2 (Questionnaire 1), as well as Table 3/Form3 (Questionnaire 2) and so on so that they have the same ParticipantID...?
I was reading a similar query somewhere else and they said to use the Form_AfterInsert Event command? Is this right (see here http://www.pcreview.co.uk/forums/thread-1687644.php)?
I feel a bit stupid but I am willing to learn and try new things Once I get started I think I will be okay. If you could steer me in the right direction it would be much appreciated.
I'm learning how to do Many to Many relationships and I think I've got the basic idea down, I am just not sure how to prevent the same 2 records from being associated twice.
For example:
My practice database deals with Authors and Books.
I was able to set it up so that Mike Gunderloy and Susan Harkins are both Authors of the book: "Upgrader's Guide to Microsoft Office System 2003".
I was also able to set it up so that Mike Gunderloy and Susan Harkins are both Authors of the book: "Automating Microsoft Access 2003 with VBA".
The thing I want to prevent is something like this:
Book: - Automating Microsoft Access 2003 with VBA
Authors: - Mike Gunderloy - Susan Harkins - Susan Harkins (Duplicate)
Background: In my Access FE, I have created a "linked table" to a file on our AS400 database. I know I can check the MSysObjects table for the linked table name, but sometimes the file actually does not exist on the AS400.
The file can be in one of three states.File exists with data.
File exists, but is empty.
File doesn't exist.
Question: What is the best way to determine the status of this linked table (file)?
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.
Attached is my many to many relationship setup. I would like to prevent the possibility of entering the same person more than once for the same training event. I am assuming that I do this by setting an index setting for a field the junction table?
there are many threads about Table Linking but i coud not find one that answers my specific questions.
1. Can i either prevent database from linking to my tables? (or give permissins ) 2. If not, can i make the table read only when linking? 3. Is there a way to confirm what databases are linked to my tables?
Code: strSQL = "INSERT INTO tblDepartments (Department) VALUES(txtnewdept)"
To insert new departments into a table, however id like it to check to see if a department name exists in tbldepartments.department to prevent duplicates being added?
I'm trying to add an image into a table. I know I can do it manually by creating an OLE Object and so forth. I am actually trying to get the user to enter in the path of the image and add it into the record/table.
Basically this is for a database that will hold a scanned image of a certificate associated with each person entered into the database. Anyone have any suggestions?
I am new to Access here, and looking to start up a database that will contain data for thousands of footballers.
I have on one table ("Directory"), all 5000+ players, with nationalities, names etc, and on another ("Flags"), I have all nations of the world and their respective flags (as an attachment).
How do I add the flag of a players nation into the "Directory" table for each record? Is there a quick way? I've tried "Lookup" but it won't let me do it for images, I've tried "Relationships" but without success.....surely I don't have to go through the "add attachment" process for all 5000 records?
I have seperated my data into seperate tables and set up one to many relationships.
tblincident -------------- Key# Report# Time Date Location
tblPerson ---------------- Key# Last Name First Name Middle Name Address etc.
tblItem ---------------- Key# Make Model Serial# etc.
What i want to do is use one form to enter all this data into the different tables.
There can only be one record in tblIncident that can match multiple records in the other tables.
i.e. for each record in tblIncident, I want to be able to have the capability to have as many persons related to that incident as I need.
I was thinking about setting up a tabctl for the data that has to be entered for tblIncident and then change the property setting for it to go away and then have the next tabctl appear in it's place for entering data into the next table. The problem I am having is that apparently I can only have one table as the control source for the form.
So next I tried using subforms, but that isn't working either. I can't figure out how to make the subform appear in a specific place on my form, sized in specific dimensions I want where I want.
I am just starting to learn about this relationships stuff and it's kind of difficult. How do you make it where you can do this from one form? Do I need to make a query of some sort?
There is a 1 to many relationship between MyForms and MyControls There is a one to many relationship between MyControls and MyLanguage
I have a function that populates these tables. For each form in the system I store 1 record on the MyForms table. I then store 1 record for each control in the form on MyControls. For each control I store N (currently 2) records on MyLanguage.
This all works fine up to a point. I noticed that after a time records were no longer getting stored on MyControls and MyLanguage.
The only way around this was to delete all records on all files (I have cascade delete so only need to delete MyForms) and the Compat and Repair the database. The compact and repair doesn't work unless I delete the records first. It seems to go astray when the MyControls table hits 14-1500 records (MyLanguage 28-3000).
I've stepped through the code line by line and the store of the records appears to go through fine.
I want code with message that can prevent user to adding a new record for an employee within specific of date through a form in the Ms Access database, but after a period of date i can, For example (after two months of the last record on the main table i can add the new record, otherwise the message will popup tell the user that this employee didn't complete tow months of last adding)
i have an unbound form with the following code which works as it should
Code: Dim rst As DAO.Recordset Set rst = CurrentDb.OpenRecordset("tbl_Courses", dbOpenDynaset) With rst .AddNew rst!DateCreated = DateCreated rst!Originator = Originator
[code]....
I also need to add other text fields from the unbound form to another table but can't seem to work out how to do it.
I have a table with more than 60 fields and need to update it with records from another Access file with a table with an identical data structure.
Is it better to run an update query or an append query (i would have to delete the original records in the target table first) or a union query?
If I run an update query I will have to manually add each field to the query.
The update query will not add 'new' records. If I run an append it is quicker because I can use the * to match all fields, but i will have to delete the 'old' records first, as both tables use autonumber for the PK so the PK ID will be the same in each table (will get a key violation error).
If I import the 'new' table and run a union query it will match the fields and add the new records, but then i will have to create new table from that query.
Now the "User" table has the ff. fields: ID(auto num),FName,MName,LName,User,Pass,Type.
Now what I want to do is, if I add a new a record in the table "User" and if the record has the data "Admin" in the field "Type" then the record should also be saved in the table "Admin" but if the data is "Teacher" or "Pupil" then it should be also saved in their respective tables.
I've received a database that is a digitized population register from the 19th century. All adults have been entered into the database, but all children are missing.
Every person has a unique number that corresponds with the original source (this variable is called 'no', this is not the autonumber primary key thing). Instead of searching in the original source which numbers are still missing, I would like to add the missing numbers (with no additional information, because I still need to type that in).
For example, the table now looks like this:
no - name_last - name_first - occupation etc
1 Smith Henry baker 2 Smith Mary 5 Williams John butcher 6 and so on
So 3 and 4 are missing.
How can I add these missing numbers automatically?
I'm developing a database for the hospital I work in. One purpose of this is to keep track of patients with temporary invasive devices (there are many types such as urinary catheters, ventilators, etc.), specifically how many days each patient has a device for. Each device is associated with one patient only, but one patient may have many devices. Here's how the associated tables are set up:
1. tblPatients - PatientID (PK), LastName, FirstName, DOB,... 2. tblLocations - LocationID (PK), LocationLabel,.... 3. tblDevices - DeviceID (PK), DeviceType, Device, DeviceDesc 4. tblDeviceUse - DeviceUseID (PK), DeviceID (FK), PatientID (FK), LocationID (FK) (where in the hospital was device inserted, e.g., operating room, bedside, etc.), DeviceStartDate, DeviceEndDate 5. tblDeviceDailyLog - DeviceLogID (PK), DeviceUseID (FK), DeviceDate, PatientLocID (FK) (area in the hospital that patient is in)
All primary keys except for PatientID & LocationID are Autonumbers; and the tables are linked appropriately.
Whenever an entry is made into tblDeviceUse, I want there to be new records to be automatically generated in tblDeviceDailyLog for each date between the Start and End Dates. For example, patient A123 had a urinary catheter from 1/1/2000 to 1/10/2000 that was inserted while the patient was in the ICU, but the patient was moved to the Medical Ward on 1/7/2000. So tblDeviceDailyLog should have 10 new records associated with this device, one for each calendar day, with the appropriate location for each day.
Hope someone can help! I was wondering if is possible to add a series of records that are in serquence to a table by just entering the first and last numbers. For example a string of numbers starting at TP11000 and ending at TP11100, the prefix TP doesn't change. Currently I have to enter every one manually, so any help would be much appreciated!
I am new to Access and have the following problem. I have one table which displays Skills (memo field) a second table which displays a skill rating ( 5 choices) and a third table which list the jobs in the company. I need to compile a fourth table which lists the skills required for each job and the corresponding ratings. I would like to have a Form in which I select the job and all 560 skills are displayed in datasheet format and I can select the ones required and allocate a skill rating. The results should then be saved to the new Table.
Here is basically what I have and what I need to do:
I have a form with several text boxes which are going to be filled in. Clicking on a button at the bottom of the form will save this information into a table (the table associated with the form). However, it also needs to fill in a junction table with two known values derived from these text boxes.
I have FILE_NUMBER_CD and INSPECTOR_NUMBER_CD that are the only attributes in the table called "XREF_FILE_INSPECTOR" which need to be added as new records.
So basically, what I need to know is how do I add known values derived from a textbox directly into a table.
I'm posting this question here as it pertains to my form but it could go in tables section as well.
I developed a prototype app in Access and have just finished upscaling it to Sybase 12.5. When I open up the associated form to add records, I am unable to do so. The built in button that allows you to do so is greyed out. When I go into the table directly, again, no ability to add recs.
I've never come across this so if anyone has any experience with this, any help would be most welcome.
Hello I need to add daily records to a related table using a form, from a button or subform displayed on a form updating the master table. This would enter the related key to the new form ready for insertion etc. Can this be done?