Primary Key And Indexing
Apr 4, 2007Could anyone tell me about the pros and cons of Primary Key and Indexing?
View RepliesCould anyone tell me about the pros and cons of Primary Key and Indexing?
View RepliesI was told by an access programmer that since the total number of records that's going to be in the db is around a few thousand tops it would be a good idea to index everything as that would speed things up. Is this true?
thanks,
scratch
G'day,
I have a products table which contains products from 4 vendors. The records have the following fields "Vendor", "Vendor Part Number"," Description", "Unit" and "Price"
I have indexed same by Vendor Part Number and Description.
The vendor's describe the same product using different descriptions.
VENDOR ....DESCRIPTION................................... .........PART NUMBER
Acme........TEKS METAL HEX+SEAL 10X16MM 100 (PKT)..123456-01
Banner.......METAL TEKS 10X16 MM..............................93a-1234
If I search by part number the search is extremely fast.
However a search on the DESCRIPTION field looking for individual words say 'Like TEKS*' and 'Like METAL*' are very slow. Obviously the indexing on the description field is probable based on sorting the 1st character of the Description field by A-Z then the second character etc.
I am wondering is there a smart way of indexing the Description field at the point of importing or creation of the Products Table where I could identify all the records with say 'TEKS' or 'METAL' or '10X16' etc. By doing this the search should be a lot faster.
Has anyone done this or do you have a pointer to an article that covers this. (I did try the search function without a suitable result)
Thanks in advance
In my table, I have a number field set to Index (dups OK). I have another field that I do not want to index but need "no dups." Any ideas?
View 4 Replies View RelatedIndexing fields can dramatically improve efficiency by speeding up sorts and searchs. My database tracks mail sent on various mail dates to multiple customers with insurance policies that are assigned unique policy numbers. I've indexed the policy number.
Question 1: Is there value in indexing a mail date field which has duplicate values even for a given customer that has received multiple mailings?
Question2 : Should one index every field in every database ? Are there scenarios where one would choose not to index a fied ? If so, can someone provide an example ?
Thanks in advance for your assistance.
Hi folks!
I'm a new user and need a hand. I'm running a query with two tables joined. I have 4 columns: Name, Day of Week, Date, Start Time. I want to create a 5th column that will number each record: 1,2,3,4,etc. I've tried researching help with indexes and primary keys etc. The main reason that I want to do this is to match up the uniques value with another query. The other query is identical with the exception of stop time versus start time. Bottom line is I want to automate a schedule for people but I'm trying to deal with shifts that go from one day into the next and I need a common denominator.
Any help would be appreciated.
Hello All
I have a field called MEMBERID
I wish to index the following so that all members in 2005 can be idexed A to Z and all members in 2006 can be indexed A to Z:
00125/05
At the moment, the last two digits that indicate the year of joining are ignored when sorted in a query, and they are all jumbled up. I have about two hundred antries for 2005, and 160 for 2006. What am I doing wrong?
Regards
Terence
London
I have an Access 2000 customer database with a hidden unbound text field that feeds customer history notes into a Main Notes section. The problem I have is the order of notes after they are given a default time stamp. At the moment the first note in the main field is the oldest but I would like to arrange the notes so that the newest note is placed at the top of the field. Can this happen?
Below is the code I use for the Notes section, where Text_14508 is the unbound hidden text box and Details is the Main Notes section.
Thanx in advance
Private Sub Text_14508_AfterUpdate()
Me.Details = Me.Details & vbCrLf & Now() & vbCrLf & Me.Text_14508 & vbCrLf
Me.Text_14508 = ""
End Sub
Private Sub Open_Notes_Click()
Text_14508.Visible = True
End Sub
I need an advice by indexing fields with low entropy.
I have some large tables with some columns that i use in selects, but they store only few vaues like (0 or 1) or ("R" or "N" or "F").
Somewhere i read, that fileds like these (with lov variety of values) do not need (or should not) to be indexed.
http://www.dbpd.com/vault/9801xtra.htm
Is this true also for access databases accessed via ODBC, or not?
Please give me an advice.
Marcel
I have a complex series of calculations to perform, and I have found the best way to achieve my end is to create new tables by the Make Table queries.
The trouble is I have many tables to create and the downstream tables refer to the previously created tables; I have recently discovered that queries perform much quicker if they are indexed (duplicates OK). I've looked at my tables created by the MakeTable queries, and they all seem not to be indexed.
How do I make them indexed automatically?
I would like to Create a database for indexing / organizing PDF documents. My Company currently use a 3rd party accounts program and we raise sales and purchases using numerical numbers ( but we can Jump to a new range of numbers within the program) for example if the purchase order numbers become simliar to the sales order numbers. But this 3rd party software does not let us scan documents into it hence the need for an alternative database.
For the data base I was thinking if only creating a index of the sales order numbers to start with. the first few question I have are.
1.) Should I Use the Autonumber as my first index column or should I replace it with our own sales order numbers in that column.
2.) is there a way to autopopulate the sales order numbers in a table for historical sales numbers.
3.) can you scan directly into Access
How to start planning the design off the database as I know this is almost the most important aspect of a database.
I have created a very simple Access database with a CompaniesTbl, ContactsTbl and CallsTbl. The database is used to record telesales contact with customers. The tables are set up like this:
The CompaniesTbl has an AutoNumber Primary Key field called CompanyID.
The ContactsTbl has an AutoNumber Primary Key field called ContactID and a foreign key called CompanyID.
The CallsTbl has an AutoNumber Primary Key field called CallID and foreign key called ContactID.
The relationships are set up in the relationships window and referential integrity imposed.
Twice now, while editing a contact record, an error has occured. Task Manager has had to be used to get out of it. The error is either a 'run-time error with a message that does not mean anything' or it says 'unrecognized database format' (!?).
If you open the database again the ContactID field in the Contacts Table is no longer a Primary Key field. If you look in the relationships window - the relationship between the Companies and Contacts tables no longer exists.
Any ideas much appreciated.
Hi,
May I know how do I go about getting the last value of the primary key that I get inserted? I need this PK to link the parent and child tables together.
Thanks for any valuable help!
Hello
I have a problem with a primary key. A table called relaties has a column relatienumber with date type: number, which is also the primary key. When a button is pressed, a function searches info from the table relaties.
The problem is the following: I figured out that when i remove the primary key constraint from the column relatienumber and save the table. the function doesn't work anymore, also when i remake the primary key for this column. How is this possible, because i changed nothing futher.
This is important because i want to change to access db to mssql db and in mssql the function also doesn't work.
It has something to do with this primary key constraint, i think :)
Who has the info???
Is it important that primary key would be a number for performance purposes?
How do I set 2 different fields as one primary key?
How do I set 2 different fields as two separate primary keys?
when defining tables, i normally set an autonumber as a primary key. However, i am working on a particular table, and i would like that no record will have identical values, in three particular fields
aaa bbb 123
aaa ccc 234
ddd fff 555
aaa bbb 123 <- i want to prevent this since a record with those three values already exists
Shall i set these three fields together as a primary key, or can i leave the autonumber as primary key and prevent such duplication in any manner ?
Thank You
Can a PK be a calculated field?
I want to be able create a PK that consists of three strings being added together. The first two would be collected from cascading combo boxes. The third field is a simple text field.
I would then run DLookup to make sure the final string is unique.
I have reasons for not using an autonumber field (there are compatibility issues with existing tables from a much older dbase database).
I have a database that I got up and running but one problem. I have as the primary key a social security number, but I can't seem to be able to add additional information to the same person. All I can seem to do is just replace or edit the one record. Is there a way that I can have more then one order for an individual instead of taking the primary key off of social security numbers?
Do I need a seperate form to enter information because I am currently workin with one form where I can enter and edit the information but no duplicates so lets say if my social was 099-999-9999 I can't add an additional order it seem unl.ess I make a whole new record and make a dummy number...
I have a tblState, every state can have multiple Counties, and every County can have multiple Municipalities
This should be a One to Many to Many, right????
However, several states might have the same County name
In order to resolve this, should I add 2 primary Keys in the tblCounty????
If so, I already tried and couldn’t configure it.
I have attached a sample DB
You can open the relationship view for a better explanation
I appreciate any kind of support
Thank you
Joe
I was wondering if anyone would be able to help me? I have two tables which can be linked together as they both contain a field called Company Name. However, in one of the tables I want Company Name to become my primary key but this field contains duplicates. How can Isolve this so that I can still link my two tables together?
View 2 Replies View RelatedHi all,
Ive written a program in .net and am currently using an access db as the backend.
In the db I had 200 test records which i deleted to get the db ready for deployment. When i add a new record now the primary key on my "booking" table carries on from the old test number so 201.
Can I resest this so it starts back at #1 as once the db gets updated, the program i wrote then takes the data and updates the accounting system and uses the primary key as the invoice number and so I would like to start at 1.
Thanks in advance
Scott
How would I go about changing the primary key to a different field in a table? :o Thanks for any help!
View 2 Replies View Relatedhey guys. i have a field by the name of ISSUE. i am using this afterupdate event procedure
which is as follow:
Private Sub ISSUE_AfterUpdate()
If Not IsNull(ISSUE) Then
ISSUE = Format(ISSUE, "000000")
End If
End Sub
if a user enter like (23) in my ISSUE field my procedure will run and it will replace
the number by (000023) to make it a six digit. i wanted to create a primary key so then a user cannot enter the same number again
or cannot duplicate a record but i cannot because primary key cannot take a null value. Can you all tell me anything to add in my procedure so that once the number is entered like (23)
another user cannot enter (23) again in the record.
Thanks
Hi
I have a little problem. I have a database with two tables: Nachweis and Entschuldigungen. In the first one u can add the records of what u have done for every day, the second one is for the days when u were absent.
I need to let the user to add in the second table only records which are NOT included in the first one. So if i have records for 10.10.2006 in the first table, i can't add records for 10.10.2006 in the second one. I wanna do it with help of the Compound Primary Key. But i don't even know where i should start.
Any help will be appreciated
Thanks in advance
it wuld be helpful if any of u can tell me how to link tables to query using primary key and foreign key or web page where i can solve my problem.
View 1 Replies View Related:eek: I have an order database via Access 2000, the backend became corrupted. I ran a a software program to recover the data. It recovered the data, but the autonumber was changed to just number and it removed primary key setting to the same field. I created a duplicate table, then ran an append query from the old table to the new one. The autonumber works, but I get the following error when I define the Primary Key and try to save...
"The changes you requested to the table were not successful, because they would create duplicate values in the index, primary key or relationship. " I cannot find any duplicates, and there is no relationships. Any suggestions? THANKS in advance for your help. Cathi