Using one of the templates from the Microsoft site I found the datasheet view of contacts that included a column with a hyperlink "Open" to open the contact's details very useful. The control source is
Code:
=IIf(IsNull([StudentID]),"New","Open")
I have modified it to "Students" and use VB instead of a macro to open the student details form.
Code:
Private Sub Open_Click()
If Not Me.NewRecord Then
DoCmd.OpenForm "frmStudentDetails", _
WhereCondition:="StudentID=" & Me.StudentID
Else
DoCmd.OpenForm "frmStudentDetails", acNormal, , acFormAdd
End If
End Sub
This works well.
I have applied exactly the same logic and code to qualifications,however, the word 'Open' is replaced with '#name?' letting you know immediately somethingis not quite correct.
Clicking on the link results in the following error:
"This error occurs when an event has failed to run because the location of the logic for the event cannot be evaluated. For example, if the OnOpen property of a form is set to =[Field], this error occurs because a macro or event name is expected to run when the event occurs."
Control Source is
Code:
=IIf(IsNull([QualificationID]),"New","Open")
The VB Event is:
Code:
Private Sub Open_Click()
If Not Me.NewRecord Then
DoCmd.OpenForm "frmQualificationDetails", _
WhereCondition:="QualificationID=" & Me.QualificationID
Else
DoCmd.OpenForm "frmQualificationDetails", acNormal, , acFormAdd
End If
End Sub
I hope someone can point out to me where my error is.
Thanks
Peter