[AccessD] Open a form and find a record

Klos, Susan Susan.Klos at fldoe.org
Mon Oct 18 13:01:39 CDT 2004


I am using the following code to open a from the menu form and filter the
records so that the user sees only their records.

    Dim stDocName As String

    Dim stLinkCriteria As String

    

    stDocName = "frmProjects"

    stLinkCriteria = "[QAFName]=" & "'" & Me![UsersName] & "'"

    

    DoCmd.Close 'Closes the menu form.

    

    DoCmd.OpenForm stDocName, , , stLinkCriteria

 

The problem is that sometimes the user's name will not  be found on the form
in the [QAFName] text box.  This would simply mean that the user is not a
"Quality Assurance" person on anybody's project.  When this happens I don't
want the form to open.  I want a message box to pop up that says "You are
not the QA on any projects".  On clicking ok on the message box the menu
opens back up.  

 

Any help would be greatly appreciated.

 

Susan Klos

Senior Database Analyst

Evaluation and Reporting

Florida Department of Education

850-245-0708 

sc 205-0708

 




More information about the AccessD mailing list