Prev: Date/Time stamp in Memo Field
Next: OpenForm
From: cutepaloma405 via AccessMonster.com on 22 Dec 2009 16:56 I have two forms: frmStudent and frmCourse. I can open frmCourse from frmStudent on the current record by linking the field txtEmployeeID and using the following code on frmCourse. Private Sub Form_Load() If Me.NewRecord Then [EmployeeID].DefaultValue = Forms![Student]![EmployeeID] End If End Sub My problem is that I cannot add more than one record with the field txtEmployeeID already on it. After that I would have to manually type in the txtEmployeeID. What can I do so that I wouldn't have to type the textEmployeeID manually? -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200912/1
From: Linq Adams via AccessMonster.com on 22 Dec 2009 17:52 Having the code in the FormLoad event means it only applies to the first record when the form opens. Try moving your code to the Form_Current event, instead. -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200912/1
From: KARL DEWEY on 22 Dec 2009 18:27 A Student can take many Courses and a Course can be taken by many Students. You need to create a one-to-many relationship between the Student and Course tables and a junction table. The junction tables needs at least two fields - StudentID and CourseID. You might want to add dates such as CourseStart and CourseEnd along with Grade, etc. -- Build a little, test a little. "cutepaloma405 via AccessMonster.com" wrote: > I have two forms: frmStudent and frmCourse. I can open frmCourse from > frmStudent on the current record by linking the field txtEmployeeID and using > the following code on frmCourse. > > Private Sub Form_Load() > If Me.NewRecord Then > [EmployeeID].DefaultValue = Forms![Student]![EmployeeID] > End If > End Sub > > My problem is that I cannot add more than one record with the field > txtEmployeeID already on it. After that I would have to manually type in the > txtEmployeeID. What can I do so that I wouldn't have to type the > textEmployeeID manually? > > -- > Message posted via AccessMonster.com > http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200912/1 > > . >
From: cutepaloma405 via AccessMonster.com on 23 Dec 2009 10:24 Linq Adams wrote: >Having the code in the FormLoad event means it only applies to the first >record when the form opens. Try moving your code to the Form_Current event, >instead. > I tried that many times. I also tired putting in AfterUpdate but nothing happens. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200912/1
From: cutepaloma405 via AccessMonster.com on 23 Dec 2009 10:25
KARL DEWEY wrote: >A Student can take many Courses and a Course can be taken by many Students. >You need to create a one-to-many relationship between the Student and Course >tables and a junction table. The junction tables needs at least two fields - >StudentID and CourseID. You might want to add dates such as CourseStart and >CourseEnd along with Grade, etc. > >> I have two forms: frmStudent and frmCourse. I can open frmCourse from >> frmStudent on the current record by linking the field txtEmployeeID and using >[quoted text clipped - 10 lines] >> txtEmployeeID. What can I do so that I wouldn't have to type the >> textEmployeeID manually? Excellent idea I will try that. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200912/1 |