empty table

R

Rover

I have a form where I run a query that creates a table. I want to
display that table on the condition that it is not empty. How do I do that?

TIA

Jim
 
T

Tony C

Try This: -
Function OpenUserTable()
Dim dbs As Database, rst as RecordSet,TempNo as Integer
Set dbs=currentdb:set rst as dbs.openrecordset("ENTER
TABLE NAME HERE",dbopendynaset)
On Error Goto continueopen
rst.movelast
TempNo=rst.RecordCount
ContinueOpen:
set rst=nothing:set dbs=nothing
if tempno=0 then exit function
Docmd.OpenTable ("ENTER TABLE NAME HERE"),SET OPTIONS HERE
End Function

You need to add "Microsoft DAO 3.6 Object Libray" to the
references in order for this to work.

The bits in CAPS are for you to enter the required table
name and to set the options when opening the Table (read
only etc).

HTH

Tony C.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top