M
Ms.Re-WA
With your help last summer, I put in the following codes and it worked
beautifully. This year I have Access 2007 instead of Access 2003 on my
computer and they are not working.
In this one, two notices should appear if this is a new record. Neither
appears when I begin a new record.
Private Sub Form_Current()
If Me.NewRecord = True Then
Me.NoAnswer.Visible = True
Me.Label48.Visible = True
End If
End Sub
This should auto fill the School and Text_used fields based on the
information in the Teachers table for a new record. Nothing happens.
Private Sub Teacher_AfterUpdate()
If Me.NewRecord Then
Me.School = DLookup("[School]", "Teachers", "[Teacher id] = " &
Me.Teacher)
Me.Text_Used = DLookup("[Text Used]", "Teachers", "[Teacher id] = " &
Me.Teacher)
End If
End Sub
As I put in the answers in the subform that the students gave on the test,
this code is supposed to increment the number in the Question id column,
which then looks up the day and question number from the Questions table.
What happens now is it fills in a "1" in the Question ID column every time.
The look up part seems to work if I manually enter the Question ID.
Private Sub Form_BeforeInsert(Cancel As Integer)
Dim IngQNbr As Long
If Me.NewRecord Then
IngQNbr = Me.Parent![Student number]
IngQNbr = Nz(DMax("[Question id]", "Test Data", "[Student id] = " &
IngQNbr), 0) + 1
If IngQNbr > DMax("[Question id]", "Questions") Then
MsgBox "No More Questions"
Cancel = True
Me.Undo
Else
Me.Question_id = IngQNbr
End If
End If
It seems that all are related to the New Record command. Has something
changed in Access 2007 that has made my code ineffectual?
Thanks for any help.
Ms. Re
beautifully. This year I have Access 2007 instead of Access 2003 on my
computer and they are not working.
In this one, two notices should appear if this is a new record. Neither
appears when I begin a new record.
Private Sub Form_Current()
If Me.NewRecord = True Then
Me.NoAnswer.Visible = True
Me.Label48.Visible = True
End If
End Sub
This should auto fill the School and Text_used fields based on the
information in the Teachers table for a new record. Nothing happens.
Private Sub Teacher_AfterUpdate()
If Me.NewRecord Then
Me.School = DLookup("[School]", "Teachers", "[Teacher id] = " &
Me.Teacher)
Me.Text_Used = DLookup("[Text Used]", "Teachers", "[Teacher id] = " &
Me.Teacher)
End If
End Sub
As I put in the answers in the subform that the students gave on the test,
this code is supposed to increment the number in the Question id column,
which then looks up the day and question number from the Questions table.
What happens now is it fills in a "1" in the Question ID column every time.
The look up part seems to work if I manually enter the Question ID.
Private Sub Form_BeforeInsert(Cancel As Integer)
Dim IngQNbr As Long
If Me.NewRecord Then
IngQNbr = Me.Parent![Student number]
IngQNbr = Nz(DMax("[Question id]", "Test Data", "[Student id] = " &
IngQNbr), 0) + 1
If IngQNbr > DMax("[Question id]", "Questions") Then
MsgBox "No More Questions"
Cancel = True
Me.Undo
Else
Me.Question_id = IngQNbr
End If
End If
It seems that all are related to the New Record command. Has something
changed in Access 2007 that has made my code ineffectual?
Thanks for any help.
Ms. Re