Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to handle reports with VB ? 1

Status
Not open for further replies.

Luix

Technical User
Jan 28, 2001
7
ES
Hi,

I need to manage a report using VB, but I don't know how to set a reference to it in code, in order to read the value of a textbox in the page #X, or in order to browse pages of the report programatcally.

Anyone can help?.. thanks in advance.
 
Hi,
When you mention "VB", are you referring to Visual Basic 6.0, or the VB that comes with Access? If it is the VB inside of Access, this is commonly referred to as VBA (Visaul Basic for Applications).
Getting back to your question: If you are running an Access report, you can read and manipulate the text boxes inside the OnFormat event for the section you wish to modify.
However, it sounds like you really want to access specific information being returned to the report from a data source, such as a table or query. If this is the case, you can use the DLookup function to retrieve individual values. If this is what you want to do, please reply back to this post and I will give you some code examples of this.

If you wish to run an Access report from Visual Basic 6.0, I can also give you the code on how to do this as well. Just let us know, ok? :) HTH, [pc2]
Randy Smith
California Teachers Association
 
Hello, Randy. Thanks for your reply.
Actually I use VBA inside Access to create and open the report, but I have very particular needs. I generate a report with several pages containing information about several customers (e.g. invoices), and I want to fax them using Winfax (by automation). So, I thougt the best was to browse page by page and read the content of a text box called FAX_N and send it out to that fax number.

The problem is that I couldn't find any way to set a reference to the open report and automate such a simple thing. It would be useful to create custom controls to browse the pages, overriding the reports's navigation buttons. Don't you think so?

Thanks again for your interest, and congratulations, I see that you are an active and helpful member of this community.

(and excuse my English)
 
Hi,
Ok, here is one idea to start working with. I presume that each invoice only belongs to one customer, is that correct? Did you know that you can have textboxes on the page header that are not visible to the reader? You can set the visible property to False, but you can still get access to the information contained within it. So, this is where you can plug in the fax phone number. You can then place code in the page footer, since each page belongs specifically to a single customer.

Re: faxing. I haven't been able to find anything on Winfax, but you can fax with the Microsoft Fax product. I have a link to a Microsoft FAQ on this topic:
HTH, [pc2]
Randy Smith
California Teachers Association
 
Hi,
That link I just gave you has some reports samples that can be downloaded. It is called: RptSmp00.exe

Well, I downloaded it, and WHAM!!!! It has a sample of how to fax using WinFax. I haven't yet uncovered the code, but it looks like this is exactly what you are looking for. HTH, [pc2]
Randy Smith
California Teachers Association
 
Hi,
More info. You can find the code to that uses WinFax inside the modules section. Look for "modFaxExample", then click on Design. Scroll down until you see the function called "WinFaxInvoices". Also take a look at the function "SendWinFax". HTH, [pc2]
Randy Smith
California Teachers Association
 
That's great!!

That's exactly what I wanted.

Thank you very much, Randy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top