Unique Index Multiple-key Issue...
Jun 22, 2005
Okay, anyone have an idea what's happening here?
It seems like it -should- work to me but it's not which leaves me to wonder where I'm missing something. :confused:
Any help'd be appreciated. :D
Thanks,
~Chad
View Replies
ADVERTISEMENT
Jul 6, 2005
I have a beginner Question....How can I set an unique Index on a field in a table if all the four fields are using duplicate values?
View 3 Replies
View Related
Jun 3, 2005
Can't figure out why I can't create a one to many relationship between two tables:
TableA uses a composite key as its primery key (field1, field2).
The table has a unique index comprised of these keys. The index even has a name. The table also doesn't contain any duplicate information, so the fields comprising my Primary Key are unique. The table I'm joining tableA is unpopulated at this time.
TableA
FIELD1 FIELD2
99999 ABCDEFG
99999 HIJKLMNO
Any help will be greatly appreciated.
View 2 Replies
View Related
May 22, 2007
Hi,
I'm not sure where to post this, maybe VBA or Forms would be better, but I think it's fundamentally an index problem, so I'm posting here. I've searched both the net and here, but most of the questions are about preventing duplicate records.
I want to prevent duplicate records but save changes to existing records.
I have a form based on a table that has a 3-field-unique-index (but not the primary index, which is autonumber). I've written a function to check for existing records with the given combination of the three fields, as long as all have data (it bails if any are null). I'm calling the function from BeforeUpdate for each of the textbox controls. I was also calling it from the form's BeforeUpdate, but commented it out as it seemed redundant. I have other code there verifying that the user wants to keep the changes.
I'm trying to save the users from getting all the way to the end before discovering there's a problem. To test it, I added then deleted one character from one of the three relevant fields in an existing record, and bing, up pops my alert that I'm violating the index. Then I can't leave the field, I'm stuck there because I can't save the record.
I want it set up so that other fields in the record can be changed/updated AND so that a new record for the same person can't be entered (a dupe).
Oh, and I'm running into all kinds of problems with acCmdSaveRecord not being available. I feel like an idiot that I haven't been able to make sense of the posts about that. I can just comment it out and let Access save the record when it closes the form. But my bosses really want the users prompted about saving changes.
Any thoughts or suggestions or insights greatly appreciated. I really tried to search this out, so any tips for better searching are also appreciated.
Here's the code for the function:
Public Function CheckForClientDupes()
Dim response As Variant
Dim strFamID, strLName, strFName As String
Dim strFilter As String
If IsNull(Me!FamilyIDNo) Or IsNull(Me!strLastName) Or IsNull(Me!strFirstName) Then
Exit Function
End If
strFilter = "[strFamilyIDNo] = """ & Me!FamilyIDNo & """ And " & "[strLastName] = """ & Me!strLastName & """ And " & "[strFirstName] = """ & Me!strFirstName & """"
If DCount("*", "tblClients", strFilter) > 0 Then
response = MsgBox("There is already a client with this combination of FamilyID, Last and First names in this database. Would you like to Continue Anyway (Yes) or cancel data entry and Erase Your Changes (No)?", vbYesNo, "Duplicate Client Alert")
If response = vbYes Then
' DoCmd.RunCommand acCmdSaveRecord
Else
response = MsgBox("You have chosen to cancel your changes. Your changes will be erased.", vbOKCancel + vbQuestion, "Data Entry Cancelled")
If response = vbOK Then
Me.Undo
Else
Exit Function
End If
End If
End If
' Me.FamilyIDNo.SetFocus
End Function
View 3 Replies
View Related
Dec 6, 2012
I am building a database to capture monthly statistics on a number of items. I want to ensure that users don't enter statistics for the same item for the same reporting period. I found the following instruction, but can't make it work:
It suggests that I create multiple primary keys in the table
When I do it, it comes back with an error: Index or primary key cannot contain a null value.
View 6 Replies
View Related
Mar 5, 2013
To prevent duplicate records, I use multiple fields indexes, which worked fine until now. I learned that each "empty" fields are consider unique by Access, so not the best in an index to prevent duplicate records. I managed to have it worked using the default value property to give each "empty" records the same value.
Now my problem is that I have a date field which is optional, but I need to use it as a unique identifier in an index. I could again use a default value, but since it has to be a date, I find it confusing. I would rather have a default value of "No date specified" or "-" or even better, "". Unfortunately none of those works with date fields.
View 7 Replies
View Related
Apr 12, 2013
I am trying a to build a slot booking database in which users will be able to book slots (ranging from 1-30) on a particular day for a specific site (location).
When trying to build the relationship between slot in tbl_available and slot in tbl_appointment i get the following error "No unique index found for the referenced field of the primary table" the same error pops up when trying to build a relationship between site in tbl_available and site in tbl_appointment.
I need both relationships to be 1 to many.
View 1 Replies
View Related
Oct 8, 2013
I am trying to create a one-to-many relationship between these two tables. I want to be able to access the 3 fields on the [Processors] table within reports based on [AllItems]. [AllItems] is a listing of account activity where the [AccountNumber] repeats. I have every field set as the "Primary Key" on [AllItems] as that is the only way to avoid importing duplicate data. I am getting the error: "no unique index found for the referenced field of the primary table"
View 3 Replies
View Related
May 24, 2006
I have a Table that lists the Members of a local football League. The Table contains Surname, FirstName, Address, DOB, Club and Age.
The table contains approx. 2,000 entries currently.
In order to stop Players re-registering with another Club, I wanted to have a message come up when the same Name & DOB were entered into the table.
I used a multiple-field index on the table covering, Surname, FirstName & DOB.
To see if this worked I typed in a Player already on the db but the system let me continue after all details were entered.
I have followed the Help in MS Access. I tried a quick sample with just 3 names in it and this worked perfectly, but now all of a sudden I have hit a snag.
I opened the table in design mode, pressed the Indexes button and proceeded to select the 3 fields required with the name of the Index in the Index Name only on the first line. Am I supposed to insert a new line in the Table or highlight something prior to doing this?
Could somebody please advise as to what I may be doing wrong?
Your help is greatly appreciated. Thank-you.
View 1 Replies
View Related
Aug 5, 2012
Add and Index named Location to the tblGuest table that consists of the StateProv and City fields and uses the default property settings, Delete the PostalCode Index, save then close the table.
I have looked up all info in the text reffering to Indexing and cant seem to come to a conclusion of the way to complete the underlined area area. For the class they provide you with the files and in this particular file the primekey is Guest ID with a field value of GuestID. There are two other Indexes PostalCode with field value PostalCode and GuestID with field value of GuestID.
View 2 Replies
View Related
Aug 14, 2013
I am working on a database of biological samples and test data. A problem is that many times the same subject has multiple ID's. For example, one subject may have the ID "ID234" but they previously had the ID "Sub84" or something like that. I want to be able to have 3 or 4 fields that have ID's for a subject, and I don't want a single one of them to be repeated. So I have column a, b, c, and d, and I don't want to have one record to have the same ID in column a as another record has in column d and so on. All I have been seeing is a way to make sure all of a, b, c, and d are unique combinations, but I want none of the fields to be repeated.
View 3 Replies
View Related
Aug 14, 2006
Hi, I'm crating this db:
Two tables, in one there are Items and services, in the other purchases.
1st table: ID - autonumber primary key
Product Name - Text
Quantity - Number
Barcode - Text
2ndt table: ID - autonumber primary key
Product Name - Text
Quantity - Number
Barcode - Text
Client - Text
Puchase Date - Date
How can I enter data to my 2nd table using unique fields (barcode, Product name actually ID in 1st table?) Problem Is Access alows only 1 unique key field in table and that is undertandable. Is there any way out in my situation.
barcode will be entered using barcode scanner it can be only text field but information like product name must fill in automatically, Product name must be drop down box if one wan't to select it manually then barcode should fill in automatically.
Please Attach your DB if you have time to look into this issue.
View 6 Replies
View Related
Mar 28, 2015
I am trying to make a basic database system to track orders and contacts and the like for my small business. I have created a series of databases that look pretty standard, something like this example:
I want to create a form that I will open and complete every time I process an order. I want to fill out both the customer info and the order details at one time.
Assuming that the "CustomerID" in the "Customers" table is set to Autonumber in order to create a unique ID, how do I keep from creating multiple new "customers" every time I enter a new order regardless of whether or not that customer already has an ID number from a prior order?
It seems that I would need to make some sort of Macro that would say something like, if the "CompanyName" entered is already listed in the 'Customer' table, use the existing CustomerID, if it is not listed in the Customer table create a new CustomerID.
Should I be looking into Macros, and if so should the macro be built into the form or the database?
View 1 Replies
View Related
Jun 20, 2014
I have a large table with information about different cars, called "Car Metadata". In this, each car has a unique identifier ("Car Code"), the make ("Manufacturer Name") and the model ("Short Model").
What I want to do is create a form with dropdown menus.I have a first combo box with all the makes in the Metadata table.
What I am having trouble with is that I want a second combo box underneath which would only show the models which correspond to the make selected in the first box.E.g. someone could select Ford in the top box and the second box would only show Fiesta, Focus etc.
Once it has done that I want it to be able to write the Car Codes for the records which match up to the make & model selected to a new table. Just to complicate things further, there can be multiple records with the same make and model but different Codes, I want all these multiple codes to be written to the final table.
View 4 Replies
View Related
May 29, 2015
I already have created & run an Access database for around 12 users. I now am looking to create a database that can have at least 30 users. Each one with a unique user ID & password (Using a security file ".mdw") Users log into a front end on a network environment. Now...My question...Is 30 to large of a user base for Access in a network environment??
View 6 Replies
View Related
Nov 22, 2013
I have create 6 tables for library books (which are differentiated by categories). Each table has different category and unique ID name e.g. F1, F2, F3..(for table 1), G1, G2, G3..(for table 2) and so on. How do I combine all those tables into 1 table for easy search for a book rather than open up each table? Tried append query but its ID run as 1, 2, 3... , not F1, F2, F3 and it only append 1 table, not the rest.
View 3 Replies
View Related
Mar 27, 2013
I tried and failed to get this to work using a multiselect listbox..I have a list of departments in tblFunctionalArea...My main table is tblStatic..I want to be able to for each record select multiple departments affected by a record and store them in the tblStatic.After looking around i couldn't find many people successfully maanging to store listbox values in a table...
I decided to create 5 fields in tblStatic and in my form create multiple combo boxes cboFunctionalArea1, cboFunctionalArea2 etc etc which are bound to these fields.I want to be able to ensure the list for any combo box requeries and takes out any selection in the other boxes.
I have this working in a strict cascade fashion i.e. in cbo1 all dept's visible, in cbo2 it takes off whatever was selected in cbo1 etc. But if someone then jumps back and deletes the content of cbo3 then the whole thing breaks or if they amend in the wrong order it breaks
View 2 Replies
View Related
Oct 20, 2005
I have read through just about every post on this forum related to "Unrecognized Database errors" and have not found a solution to my direct problem.
Stats:
Database is running Access2K on all machines; db is on network location, no sharing issues or permission issues have been identified, no other databases in this network location have had this problem. also, we have tried compact-repair and also have tried re-creating the database and neither have proved successful.
I can open the database just fine if I am the only one opening it. If someone else tries to open it once I have it opened one of the following occurs:
1. Nothing. Hourglass appears for a split second, then nothing happens.
2. Error message "unrecognized database format "mydb.mdb"" appears. If I click OK and both users close the db, it can be opened just fine again by the first user. It doesn't matterwho opens it first, but the second user gets this message.
Any ideas why this is happening?
Thanks!
View 3 Replies
View Related
Aug 1, 2014
I have been working on a simple data base for some time now (beginner level) and am still trying to improve it. I would like to do something but before that I would like to have your opinion to know if it is even possible?I have a query QryMainReport:
Start Date/Time
End Date/Time
Employee
At the moment this is what the format of my report looks like (I removed other unnecessary fields):
StartTime----------EndTime---------------Employee
12/06/2014 01:00--12/06/2014 03:00------John Smith
12/06/2014 04:00--12/06/2014 06:00------Jane Doe
13/06/2014 02:00--13/06/2014 05:00------John Smith
13/06/2014 08:00--13/06/2014 08:00------Jane Doe
I would like to do as a report. (Dates would always be from Sunday to Saturday). I am not sure it is possible to do that. I suppose first it would mean:I would have to do a query to separate the times from the dates?I would have to find a way for Access to find the unique dates and unique names?Does it mean I have to use cross tab queries?
View 2 Replies
View Related
May 15, 2006
hi
when creating indexes for databases what needs to be indexed? is there an article online that explains it??
View 5 Replies
View Related
Apr 21, 2006
i
i do a sum on a field..... if i put an index on this field
does query will be faster?
thank
View 1 Replies
View Related
Aug 23, 2005
I created a help file for a using a db I created, though I am thinking it would be nice to have it "look more professional" something similar to the Contexts and Index help option found in IE.
I am think a form would be the easiest to do with a subform for each element in the contents, so when the user clicks on an element on left form (which is the contents) the detail of that page appears in the right form the subform (perhaps just using the visible property)
There are tab options for a form so I can use that to make the contents, Index, search, favorites
some questions come to mind though...
0) how would I create collapsible menu (like a tree menu) see the contexts and Index help option found in IE.
1) how to create a search field to look for anything in the db except the code (i.e. part of a record, a description of the record, etc.) ?
2) how would I create a favorites section (a place to save help topics viewed) ?
3) how do i create a navigation system (back and forward through the subforms) - it seems I would need to track which forms are displayed and when then use that to navigate back and forward ?
4) how create various options such as stop or refresh search queries, and perhaps turning on/off select highlight
Finally is there something similar to this already out there that I can just customize various options off of, perhaps even a tutorial.
thanks for any direction you might be able to provide.
View 2 Replies
View Related
Nov 23, 2005
I have ID field data type is auto number
I need to initilize it to zero after deleting all the records.....
tell me a way to do this
View 1 Replies
View Related
Jan 21, 2007
I have 2 fealds ( Id and date ) they are primery keys in the table , I want to prevent duplacte id to the same date . ( MSGBOX after update the date )
View 7 Replies
View Related
Feb 21, 2008
When I load a spreadsheet I can't add an index because it is a linked table, so I want to save it in MDB format so that I can add an index and then export it to SQL. However, when I save the file as an MDB file the data is all still linked as a spreadsheet and I still can't add an index. (I would add the index at the last step in SQL, but Pervasive SQL is very temperamental.)
Basically I just want to export an Excel spreadsheet into SQL and add an index.
View 3 Replies
View Related
Feb 7, 2005
Can anyone tell me why access puts the primary key field in the index list twice for the same table? For example i have a primary key called CustID, when i go into design view and click on the index button on the toolbar, i see it listed twice, once as primary key and then again as its own field?!
I dont see the reason for this but often times with many of my databases i see this happen to many of my tables. :confused:
View 2 Replies
View Related