G
Guest
Hi all
I've been stucked at this for sometime. But nothing i do seems to solve my problem
I have a form that allow user to enter the daily schedule of the bus driver to pick up the students. A query, qryBusSchedule, retrieving data from 2 tables, is used as the recordsource of the form. The 2 tables are studentMaster table and the transportRecord table. These 2 tables are related based on the studentNo
Structure of the tables and queries are as follow
studentMaster(*studentNo, Name, Surname, ....
transportRecord(*Date, *Time, +studentNo, fromLocation, toLocation
qryBusSchedule(transportRecord.Date, transportRecord.Time, studentMaster.Name, transportRecord.studentNo, transportRecord.fromLocation, transportRecord.toLocation
* symbolises P
+ symbolises F
transportRecord's primary key is a composite key of Date, Time and studentNo(foreign key from studentMaster table
SQL codes for generating the query, qryBusSchedule
-----
SELECT studentMaster.Name, transportRecord.
FROM studentMaster, transportRecor
WHERE (((transportRecord.IDNo)=studentMaster.IDNo)
ORDER BY transportRecord.Date, transportRecord.Time
-----
In the form, Name is a combo box, when the user select the name of the student, the studentNo textfield is automatically populated.
Problem:
Even though I've entered values for Date, Time and selected a value for Name (studentNo, automatically populated in studentNo textfield) and i try to save the new record, I am given an error "Index or Primary key cannot contain a null value". Therefore I am unable to save the item into the bus schedule. BUT if i simply enter the Date, Time and studentNo into their respective textboxes in the form without selecting a value in the combo box for Name, I am able to save the newly inserted record
Can anyone advise me what have I done wrong? and how can I correct my mistake? so that i can allow user to simply select the student's Name instead of the studentNo when adding a new record to the bus schedule
Thanks a lot
yann
I've been stucked at this for sometime. But nothing i do seems to solve my problem
I have a form that allow user to enter the daily schedule of the bus driver to pick up the students. A query, qryBusSchedule, retrieving data from 2 tables, is used as the recordsource of the form. The 2 tables are studentMaster table and the transportRecord table. These 2 tables are related based on the studentNo
Structure of the tables and queries are as follow
studentMaster(*studentNo, Name, Surname, ....
transportRecord(*Date, *Time, +studentNo, fromLocation, toLocation
qryBusSchedule(transportRecord.Date, transportRecord.Time, studentMaster.Name, transportRecord.studentNo, transportRecord.fromLocation, transportRecord.toLocation
* symbolises P
+ symbolises F
transportRecord's primary key is a composite key of Date, Time and studentNo(foreign key from studentMaster table
SQL codes for generating the query, qryBusSchedule
-----
SELECT studentMaster.Name, transportRecord.
FROM studentMaster, transportRecor
WHERE (((transportRecord.IDNo)=studentMaster.IDNo)
ORDER BY transportRecord.Date, transportRecord.Time
-----
In the form, Name is a combo box, when the user select the name of the student, the studentNo textfield is automatically populated.
Problem:
Even though I've entered values for Date, Time and selected a value for Name (studentNo, automatically populated in studentNo textfield) and i try to save the new record, I am given an error "Index or Primary key cannot contain a null value". Therefore I am unable to save the item into the bus schedule. BUT if i simply enter the Date, Time and studentNo into their respective textboxes in the form without selecting a value in the combo box for Name, I am able to save the newly inserted record
Can anyone advise me what have I done wrong? and how can I correct my mistake? so that i can allow user to simply select the student's Name instead of the studentNo when adding a new record to the bus schedule
Thanks a lot
yann