Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Macros / September 2006

Tip: Looking for answers? Try searching our database.

Get Record Count Number by Macros

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Florence - 26 Sep 2006 05:32 GMT
Dear all,

Is it possible to get the numbers of records from a query / table by using
Macros?

Thx in advanced.
Steve Schapel - 26 Sep 2006 07:19 GMT
Florence,

No, this is not a job for a macro.  You can get the number of records
via a Totals Query, using Count.  Or you can use a DCount function, for
example DCount("*","YourTable").  If you need more explicit help, can
you explain a bit more detail about how and where you need to use this
figure?

Signature

Steve Schapel, Microsoft Access MVP

> Dear all,
>
> Is it possible to get the numbers of records from a query / table by using
> Macros?
>
> Thx in advanced.
Florence - 26 Sep 2006 07:53 GMT
Dear Steve,

Yes of course.

I have a text file exported by a query which is working fine by using Macros.

Now I need to insert 1 line at the end of the text file showing the total
number of records included in this text file.  For example, if 100 records in
the query, the text file from line 1 to 100 will be these record lines and
then at the line 101, I need to put a string "END 101".

So I need to have another query getting the number of records first?  Any
other alternatives are appreciated.

Thanks!

> Florence,
>
[quoted text clipped - 10 lines]
> >
> > Thx in advanced.
Steve Schapel - 26 Sep 2006 08:41 GMT
Florence,

It is possible to use a VBA procedure to open and write to the text file
itself, after the detail records have been exported to it.

Apart from that, the only way I can think of to achieve this is to
export from a Union Query.  This would potentially be a lot easier, but
depends on the structure of the text file being exported.  For example,
if you are exporting from a multi-field query, and the text file has
comma delimiters between the fields, then the Union Query would need to
export the same number of fields for the last line as well, so you will
end up with the same number of commas after the "END 101" as there are
fields in the main query, if you see what I mean.

Signature

Steve Schapel, Microsoft Access MVP

> Dear Steve,
>
[quoted text clipped - 9 lines]
> So I need to have another query getting the number of records first?  Any
> other alternatives are appreciated.
Florence - 26 Sep 2006 10:03 GMT
Steve,

Yes, I got what you mean.  And I don't want to have the same number of comma
delimiters for the last line.

I think I have to rewrite it by VBA.

Thanks anyway.

> Florence,
>
[quoted text clipped - 23 lines]
> > So I need to have another query getting the number of records first?  Any
> > other alternatives are appreciated.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.