473,396 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

error when selecting data from the dropdown list

I have a form which has a subform.In the main form I have only one
field (this is a drop down list and has a query attached to it) which
selects empno,Name from the EmployeeInformation table.

The sub form stores the time sheet data for each employee.When I am
able to do the timesheet data entry for the first record.But when I
select the second employee from the dropdown list and click on the
subform for entering the timesheet data, it says " The changes you
requested to the table were not succesful because they could create
duplicate values in the index,primary key or relationship.Change the
data in the field or fields that contain duplicate data, remove the
index or redifine the index to permit duplicate entries and try again"

Well,I am able to do data entry in the datasheet.Can anyone please
help me with solving this problem

Thanks
Nov 12 '05 #1
4 1969
Yout question is a little short or information but....

I should have thought that the main form should be bound to the Employee
Table with possibly the name showing for verification, and fine, use the
dropdown to select the employee.

I also guess that the time sheet subform is based on a table with
TimeSheetID AutoNumber Key
EmployeeID Long Indexed Duplicates allowed
TimeOn, TimeOff, etc

Assuming that the Link Child & Master Fields is EmployeeID, there should be
no problem.
Are you sure that the EmployeeID in the TimeSheet table allows duplicates?

Phil

"Doslil" <do****@hotmail.com> wrote in message
news:c6************************@posting.google.com ...
I have a form which has a subform.In the main form I have only one
field (this is a drop down list and has a query attached to it) which
selects empno,Name from the EmployeeInformation table.

The sub form stores the time sheet data for each employee.When I am
able to do the timesheet data entry for the first record.But when I
select the second employee from the dropdown list and click on the
subform for entering the timesheet data, it says " The changes you
requested to the table were not succesful because they could create
duplicate values in the index,primary key or relationship.Change the
data in the field or fields that contain duplicate data, remove the
index or redifine the index to permit duplicate entries and try again"

Well,I am able to do data entry in the datasheet.Can anyone please
help me with solving this problem

Thanks

Nov 12 '05 #2

yes,

The employee number in the child table allows duplicates.

The structure is like this.

EmployeeInformation (master table)

Employeenumber(PK)
FirstName
LastName
SSNumber
Title
Position

TimeSheet(child Table)
EmployeeNumber(linked to master table,allows duplicates)
date
day
TimeIN
TimeOut
All I have done in the form is attached a query to the employeenumber
(this is a dropdown list)selecting the employee number from the master
table.I see the record selector in the form is not moving to the next
record.I have not attached any code other than the query.

I hope you'll get a clear picture of what I have done :)
Let me know if you need further clarification
regards
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3
Lets call the dropdown box FindEmployee.
What normally happens is that your dropdown list is based on a query like
"SELECT Lastname, FirstName, EmployeeNumber FROM EmployeeInformation ORDER
BY LastName, FirstName;"
Make sure that it is unbound, there are 3 columns, the column widths are
something like 4cm;4cm;0cm and the bound column is column 3 (the emplyee
number)

I am assuming the EmployeeNumber is an autonumber.

On the main form I am assuming you have all the employee details

On the AfterUpdate event you need
DoCmd.GotoControl "EmployeeNumber"
DoCmd.FindRecord FindEmployee

This should make the main record of the form the selected employee
As I said before the LinkMasterFields and the LinkSlaveFilds of the subform
should both be set to EmployeeNumber

Otherwise I can offer no help

Phil
"Dos Lil" <do****@hotmail.com> wrote in message
news:3f*********************@news.frii.net...

yes,

The employee number in the child table allows duplicates.

The structure is like this.

EmployeeInformation (master table)

Employeenumber(PK)
FirstName
LastName
SSNumber
Title
Position

TimeSheet(child Table)
EmployeeNumber(linked to master table,allows duplicates)
date
day
TimeIN
TimeOut
All I have done in the form is attached a query to the employeenumber
(this is a dropdown list)selecting the employee number from the master
table.I see the record selector in the form is not moving to the next
record.I have not attached any code other than the query.

I hope you'll get a clear picture of what I have done :)
Let me know if you need further clarification
regards
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #4
Thanks phil,

Fixed the problem by adding an unbound combo list and an unbound subform
with a simple select query

regards
Dos lil

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rod Early | last post by:
I need to know when the select element's dropdown list is opened (as when the user clicks on the arrow or does ALT-downarrow from the keyboard). Similarly, I need to known when the dropdown list...
1
by: jzhang29 | last post by:
I have a JSP page and it contains a dropdown list called Office. What I try to do is: When I select different office from this list, the information of office (address, phone,etc) will be...
5
by: izco | last post by:
Hi all, I'm trying to edit data in a dataset, and keep getting errors. I'm selecting data from SQL, and a few different fields are either 1 or 0 based on the way questions were answered...
6
by: Mike Wilson | last post by:
Dear Group, I have a heirarchical set of database tables, say - "order" and "order_type" and want to display a series of orders in a grid control, and in place of the order_type foreign key...
0
by: koti | last post by:
hi i have written some code for selecting an item in combobox dropdown list which is in datagrid columm. by scrolling the mouse we select any item from the list. but by pressing the down key...
11
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked....
5
by: Bjorn Sagbakken | last post by:
Hello I have just migrated from VS 2003 to VS 2005, and .NET framework 1.1 to 2.0 I am at the end of debugging and fixing stuff. Now there is one error I just cannot find a solution to: On...
2
by: =?Utf-8?B?S3Jpc2huYQ==?= | last post by:
Hi, I am devloping one web application using .net framework 2.0.One page has 7 dropdown list control.When i update the values first bind the values to the drop down llist then selected text...
2
by: JJ297 | last post by:
I have a dropdown list populated via a database. I edited the dropdown list to have "select a topic" to always appear when the drop down loads. Now if a user selects a dropdown item it goes into...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.