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

How to test for empty recordset from query 1

Status
Not open for further replies.

srast

MIS
Nov 11, 2002
42
US
Hi!
What I am trying to do is as follows:
I have a Data Entry form which allows the user to enter a customer order. I have a button which opens a second form, (entitled "Not Enough Form") displaying all items for which the order cannot be filled, because the inventory is too low. This form is based on a query which checks the inventory. What I want to do is check the query results, and if there are none, (meaning, there are enough of all items), I want to open a different form. I tried to put the following code in "Not Enough Forms"'s Form_Open method:
Dim rs As Recordset
Set rs = Me.RecordsetClone
rs.MoveFirst
If rs.RecordCount < 1 Then
MsgBox &quot;All orders are valid.&quot;,vbOKOnly, &quot;Okey Dokey&quot;
Cancel = True

However I got error 13, Type mismatch at the Set rs = Me.recorsetClone line.

Any Ideas?
I tried DOA.recordset and got a compile error: user definfed
type not defined.

Thanks!!
Srast
 
Try using the DCount function. You can look up the general syntax in help. Without knowing what your query looks like it is hard to show a complete example.

DCount(&quot;someQueryField&quot;, &quot;QueryName&quot;, &quot;Query where clause&quot;)

Feel free to post your query SQL if you need some additional help.

Good Luck!
Please remember to give helpful posts the stars they deserve! This makes the post more visible to others in need![thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top