PDA

View Full Version : Need help to add a "schoolName" in a form when a user clicks on a list of schoolnames



keek2a4
03-25-2008, 08:10 AM
Hello People,

Need some help, heres my explanation..

I have three tables with the following fields:

1. tblStudent (studentID (PK), studentName)
2. tblSchool (schoolID (PK), schoolName)
3. tblExam (fkstudentName, mathResult, sciResult, engResult and fkSchoolName)

I have a form called "frmExamDetails" that has the table "tblExam" as a source record and using the form I can select a student Name from a dropdown and enter in the marks of the student name selected. I also have a field that displays the schoolName which cannot be edited. Hence I have text box's locked property set to "Yes" so it only displays the schoolName and does not let the user to edit it.

Here is my Question, I need a button named "Assign School" and when pressed, it displays a list of all the school Names in another form and when
double click on one of the names in the list, it changes the School Name in the first form. Could someone plz advise me on how to do this? I have attached a sample database will all the table and forms to give you a clear picture.

Thanks,

(ps I cannot use a Dropdown for the school Name, I am required to only use the methoded mentioned above?)

orange
03-25-2008, 12:14 PM
Hello People,

Need some help, heres my explanation..

I have three tables with the following fields:

1. tblStudent (studentID (PK), studentName)
2. tblSchool (schoolID (PK), schoolName)
3. tblExam (fkstudentName, mathResult, sciResult, engResult and fkSchoolName)

I have a form called "frmExamDetails" that has the table "tblExam" as a source record and using the form I can select a student Name from a dropdown and enter in the marks of the student name selected. I also have a field that displays the schoolName which cannot be edited. Hence I have text box's locked property set to "Yes" so it only displays the schoolName and does not let the user to edit it.

Here is my Question, I need a button named "Assign School" and when pressed, it displays a list of all the school Names in another form and when
double click on one of the names in the list, it changes the School Name in the first form. Could someone plz advise me on how to do this? I have attached a sample database will all the table and forms to give you a clear picture.

Thanks,

(ps I cannot use a Dropdown for the school Name, I am required to only use the methoded mentioned above?)
You may find some useful info here:
http://www.fontstuff.com/siteindex.htm#access

Trevor
03-25-2008, 03:24 PM
ok, I havn't looked at your attachement but from memorie
heres code example to move data from one form to another

private sub cmdbutton onclick()
stDocName = "school list form"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End sub
Private sub cmdbutton ondblclick()
Dim Slf as form ' declars a value for the form you want to transfer to instead of typing the complete path
set SLF = forms![form1] 'SLF is value I assigned to the form you want to transfer to, and forms![form1] ' form1 replace with the name of the form where the school list is
SLF![Schoollist] = Me.[School pick] ' SLF![Schoollist] is the value above givin tho the form you want to transfer to, and [schoollist] is the name of the fied you want eo populate, Me.[school pick] , the Me. refers to the form you are currently on, and [school pick] is the name of the textbox that contains the list of schools
DoCmd.Close acform, "form1", acsaveno ' DoCmd, will then close that for of shool lists to pick from and not save any values on that list, but you will still have your value copied to the form
End sub

Trevor
03-25-2008, 04:19 PM
attached is your DB with the changes made to copy from school list to examdetails, I have also removed your query's and replaced them in row source with select queries,(that perform the same function as the query yau had written