Query based Report in Access using VBA

A

amith.srinivas

Hi all,
From a word macro in VBA, I am trying to create a report in
access DB. The report is based on a query with a parameter. I am using

Set rpt = Application.CreateReport
rpt.RecordSource = <<Query_Name>>

Once I create the report, I m trying to create labels to display the
Report title in the Report Header section.

Set ctl = database.CreateReportControl(rpt.Name, acLabel, acHeader)

But this statement is failing with an error that section number is
invalid.

Then I am trying to get the column headers as labels in Pageheader
section of the report.
Set ctl = DB.CreateReportControl(repName, acLabel, acPageHeader)
ctl.Properties("Caption") = "Id"
This is not failing but the the label is not at all visible in the
design of the Report.

Then I m trying to use a textbox bound to the fields in the recordset.
I m able to get the values visible in the report.
Set ctl = qDB.CreateReportControl(repName, acTextBox, acDetail,
ColumnName:="Id")

Can anbody please tell me if there is any other better alternative to
create a simple query based report than the one I have adopted.

If not, how do i make those labels visible in the Report Header
section to set the title of the report.

I am pretty new to access and just wondering whats being wrong here.

Is there any way in VBA to go for "AutoReport: Tabular" report
????????

Any help would greatly be appreciated.

Thanks,
Am.It
 
G

Guest

I see that you have separately posted the same question in
some other group.

So the reply I wrote is not visible here, someone else
will repeat the same things I said, and any errors I
have made will not be corrected by people who reply
here.

As a curtesy to members of this group, I would post the
name of the other group where you have repeated this
question, but I'm not sure where that is.

Often people who post multiple copies of the same question
have the same problem, and never even see some of the
answers others have laboured over.

For that reason, if I am aware that a question is separately
posted in multiple groups, I never bother to answer.

To avoid this problem, put the names of all of the groups you are posting to
into the address field of one posting. But One group is normally enough.

(david)
 
A

amith.srinivas

David,
Firstly, I would like to apologize for not copying the name
of the groups where I have posted the question though it was not
intentional in doing so. This is the first time I am posting a question
in google groups and did not even know that there was Cc field in the
mail. I have sent a mail to each of the groups separately. Infact you
just helped me in knowing a way to send a single post to multiple
groups.Next time I do that, I will make sure that Followup-to field is
filled up.

I saw your solution in the other group and would like to thank you for
the same. I have replied to your answer in that group itself.

Thanks,
Am.It
 
G

Guest

It's OK. My rudeness to a new user was unjustifiable.

In any case, I see that the other group is

microsoft.public.access.modulesdaovba

(david)
 

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