[AccessD] Help with function

Wortz, Charles CWortz at tea.state.tx.us
Thu Mar 6 07:48:00 CST 2003


Virginia,
 
I presume you still have your second method so I will suggest how to
modify it.
 
1.  Open the form with its Visible property set to False.
2.  Change the IF statement to 
IF IsNull(...) Then
    MsgBox ...
    DoCmd.Close ...
Else
    'set form's Visible property to True
End If
 
 
Charles Wortz 
Software Development Division 
Texas Education Agency 
1701 N. Congress Ave 
Austin, TX 78701-1494 
512-463-9493 
CWortz at tea.state.tx.us 
-----Original Message-----
From: Hollis,Virginia [mailto:HollisVJ at pgdp.usec.com] 
Sent: Thursday 2003 Mar 06 07:34
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/2e3b00da/attachment-0001.html>


More information about the AccessD mailing list