Need help with statement

  • Thread starter Thread starter David Ehrenreich
  • Start date Start date
D

David Ehrenreich

What would like to do is use dlookup to find a students
social and also if a test has been taken. If both of
these match then a messagebox appears.

Here is what I have so far, but it's not working

If Not Isnull(Dlookup"StudentID", "PlacementDataQry", _
"TestName = Placement AND StudentID='" & _
Me.StudentID & "'" Then
Msgbox"Student has takem Placement Before"
End IF

Any help would be great.

Thanks Ahead

David Ehrenreich
 
-----Original Message-----
What would like to do is use dlookup to find a students
social and also if a test has been taken. If both of
these match then a messagebox appears.

Here is what I have so far, but it's not working

If Not Isnull(Dlookup"StudentID", "PlacementDataQry", _
"TestName = Placement AND StudentID='" & _
Me.StudentID & "'" Then
Msgbox"Student has takem Placement Before"
End IF

Any help would be great.

Thanks Ahead

David Ehrenreich
.
Hi David,

first impression is that the following is missing brackets:
Isnull(Dlookup"StudentID", "PlacementDataQry", _
"TestName = Placement AND StudentID='" & _
Me.StudentID & "'"


try:

Isnull(Dlookup("StudentID", "PlacementDataQry", _
"TestName = Placement AND StudentID='" & _
Me.StudentID & "'"))

Luck
Jonathan
 
What would like to do is use dlookup to find a students
social and also if a test has been taken. If both of
these match then a messagebox appears.

Here is what I have so far, but it's not working

If Not Isnull(Dlookup"StudentID", "PlacementDataQry", _
"TestName = Placement AND StudentID='" & _
Me.StudentID & "'" Then
Msgbox"Student has takem Placement Before"
End IF

Any help would be great.

You're missing parentheses around the DLookUp function's arguments,
and the required quotemark delimiters around the text field criterion.
If StudentID is numeric, you should NOT use quotemarks around it. Try

If Not Isnull(Dlookup("StudentID", "PlacementDataQry", _
"TestName = 'Placement' AND StudentID=" & _
Me.StudentID) Then
Msgbox "Student has takem Placement Before"
End If
 
Back
Top