PC Review


Reply
Thread Tools Rate Thread

How to count table records in a macro

 
 
Joe M.
Guest
Posts: n/a
 
      1st Dec 2009
Hi. I have a macro that uses Transferspreadsheet action to copy a Excel
spreadsheet into a table. The table is created by the user. Prior to
importing the spreadsheet I use Delete to empty the table contents. Since the
user may create the spreadsheet incorrectly causing the import to fail
(meaning zero records will be transferred) I am trying to produce a
conditional message if there are zero records in the table. What can I put in
the condition column to test the count of the table records (i.e.
recordcount=0) ? Also the user runs the macro from a shortcut on out shared
drive and not from a form.

Thanks!
Joe M.
 
Reply With Quote
 
 
 
 
Steve Schapel
Guest
Posts: n/a
 
      2nd Dec 2009
Joe,

Condition would be:
DCount("*","NameOfYourTable")=0

--
Steve Schapel, Microsoft Access MVP


"Joe M." <(E-Mail Removed)> wrote in message
news:72CCBCDD-85C0-420F-80F7-(E-Mail Removed)...
> Hi. I have a macro that uses Transferspreadsheet action to copy a Excel
> spreadsheet into a table. The table is created by the user. Prior to
> importing the spreadsheet I use Delete to empty the table contents. Since
> the
> user may create the spreadsheet incorrectly causing the import to fail
> (meaning zero records will be transferred) I am trying to produce a
> conditional message if there are zero records in the table. What can I put
> in
> the condition column to test the count of the table records (i.e.
> recordcount=0) ? Also the user runs the macro from a shortcut on out
> shared
> drive and not from a form.
>
> Thanks!
> Joe M.


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count records in Table Murray Microsoft Access 2 13th Jun 2008 07:32 AM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Microsoft Excel Misc 1 3rd May 2008 10:52 AM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Microsoft Excel Worksheet Functions 0 3rd May 2008 01:04 AM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Microsoft Excel Programming 0 3rd May 2008 01:03 AM
Count records in table =?Utf-8?B?S2FyZW5N?= Microsoft Access 8 26th Feb 2005 01:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:35 PM.