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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Query For RecordSource 1

Status
Not open for further replies.

fazm

MIS
Jun 25, 2003
11
US
Can anyone give some insight to this:

I have a query:

SELECT a.ClientID, a.ClientFirstNm, a.ClientLastNm, b.EmployeeFirstNm, b.EmployeeLastNm, b.CaseLoadID
FROM tblClient AS a, tblEmployee AS b
WHERE a.CaseLoadID=b.CaseLoadID And ClientID=[Enter Client ID];

This is being used as the recordsource on a form via the properties window. Works great, but is there a way to have a msgbox pop up when the query dosent make a match in the database. The form just displays a blank form, no fields, just grayed out.

I have tried everything from capturing the contents of an input box, passing that value into my SQL string, and making the forms record source equal to the query in VBA, but have no luck.

The OnError only works with a valid run-time error and since this query doesnt cause a run-time error its a no go.

Any help or idea's would be great, thanks.
 
In the Form_Load event

If (Me.Recordset.RecordCount = 0) Then
MsgBox = "No Records"
' do whatever else you need to do.
End If


Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Thanks CajunCenturion for the quick response!!!

It worked perfect!!

I was making it to hard on myself!! Thanks again!
 
You're quite welcome.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top