Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If form filter yields no records.... 1

Status
Not open for further replies.

ATAIntern

Programmer
Feb 20, 2001
7
US
Hi, all!

I have a form set up to display only certain records in a table, using a filter, to wit:

Code:
     Me.Filter = "DeptCode = '" & Forms!SelectProject!cboDept & "' AND StatusID = 'A'"
     Me.FilterOn = True

Now, I'd like to have an escape clause to display a MsgBox and not open the form if the filter results in NO records to display. I tried this, and it ain't right, but I don't know what to test for instead:

Code:
     If IsNull(Me.CurrentRecord) Then
          MsgBox "There are no active projects for this department.", vbExclamation, "No Active Projects"
          DoCmd.Close
     End If

Any help greatly appreciated.... You all have been very helpful since I found you a few weeks ago!

ATAIntern(-:
 
Wouldn't it be better to limit the combobox selection choices to only active projects? Then you wouldn't have to worry about returning a null recordset as only valid choices would be available to begin with.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top