OpenForm

  • Thread starter cutepaloma405 via AccessMonster.com
  • Start date
C

cutepaloma405 via AccessMonster.com

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?
 
L

Linq Adams via AccessMonster.com

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.
 
K

KARL DEWEY

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.
 
C

cutepaloma405 via AccessMonster.com

Linq said:
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.
 
C

cutepaloma405 via AccessMonster.com

KARL said:
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.
 
C

cutepaloma405 via AccessMonster.com

Linq said:
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 to do that but nothing happened.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top