[AccessD] Help with function

John Frederick j.frederick at att.net
Thu Mar 6 08:25:00 CST 2003


I don't see anything in my documentation on the IsNull funtion in Access 97
or Access 2000 that suggests that a query name can be used as you do in both
of your examples.  My first attempt would be to say:

Function NoEval()
    If DCount("*","qry_EvaluatorNull") > 0 Then  'gives the number of
records returned by the query
        DoCmd.OpenForm "frm_RCSE", acNormal, "qry_EvaluatorNull", ,
acFormEdit, acWindowNormal
    Else
        MsgBox "All RCSEs have been assigned to an Evaluator"
    End If
End Function
  -----Original Message-----
  From: accessd-admin at databaseadvisors.com
[mailto:accessd-admin at databaseadvisors.com]On Behalf Of Hollis,Virginia
  Sent: Thursday, March 06, 2003 8:34 AM
  To: 'accessd at databaseadvisors.com'
  Subject: [AccessD] Help with function


  I am trying to write a function that will open a form with a filter. I
can't seem to get it in the correct order. I tried it two different ways as
shown below. If the evaluator has been assigned, I do not want the form to
open, the message "All assigned" should show.

  In the first try, the message does not show at all. The second try, the
message works, but the form still opens, so I added the last line of
DoCmd.Close acform, "frm_RCSE". The form shows then closes. I would like the
form not to even show. I tried adding an On Error Resume Next, but that did
not work either, the form still opened & then closed.

  Virginia

  *******One Way**********
  Function NoEval()
      If Not IsNull("qry_EvaluatorNull.evaluatorID") Then
          DoCmd.OpenForm "frm_RCSE", acNormal, "qry_EvaluatorNull", ,
acFormEdit, acWindowNormal
      Else
          MsgBox "All RCSEs have been assigned to an Evaluator"
          DoCmd.Close acForm, "frm_RCSE"
      End If
  End Function

  **********Second try*********
  Function NoEval()
          DoCmd.OpenForm "frm_RCSE", acNormal, "qry_EvaluatorNull", ,
acFormEdit, acWindowNormal
      If Not IsNull("qry_EvaluatorNull.evaluatorID") Then
          MsgBox "All RCSEs have been assigned to an Evaluator"
          DoCmd.Close acForm, "frm_RCSE"
      End If
  End Function

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030306/8361dcfb/attachment-0001.html>


More information about the AccessD mailing list