Group:  Microsoft Access ยป microsoft.public.access.macros
Thread: Get Record Count Number by Macros

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Get Record Count Number by Macros
Florence 26.09.2006 04:32:01
Dear all,

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

Thx in advanced.

Re: Get Record Count Number by Macros
Steve Schapel <schapel[ at ]mvps.org.ns> 26.09.2006 06:19:03
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?

--
Steve Schapel, Microsoft Access MVP

Florence wrote:
[Quoted Text]
> Dear all,
>
> Is it possible to get the numbers of records from a query / table by using
> Macros?
>
> Thx in advanced.
>
Re: Get Record Count Number by Macros
Florence 26.09.2006 06:53:02
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!


"Steve Schapel" wrote:

[Quoted Text]
> 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?
>
> --
> Steve Schapel, Microsoft Access MVP
>
> Florence wrote:
> > Dear all,
> >
> > Is it possible to get the numbers of records from a query / table by using
> > Macros?
> >
> > Thx in advanced.
> >
>
Re: Get Record Count Number by Macros
Steve Schapel <schapel[ at ]mvps.org.ns> 26.09.2006 07:41:17
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.

--
Steve Schapel, Microsoft Access MVP

Florence wrote:
[Quoted Text]
> 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.
Re: Get Record Count Number by Macros
Florence 26.09.2006 09:03:02
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.


"Steve Schapel" wrote:

[Quoted Text]
> 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.
>
> --
> Steve Schapel, Microsoft Access MVP
>
> Florence wrote:
> > 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.
>

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net