Solved

accessing foxpro free table from visual basic

Posted on 2004-04-29
3
242 Views
Last Modified: 2010-04-17
i have atbale called product created in foxpro 2.5
something like this
p_name -text
valid -memo ...similarily 10 such memo fields
now i want to make form in visual basic for creating a report
where in the user can enter the name of the product and the report should be generated for that product i tried in foxpro but the labels cannot be made bold since i want to gve printing on inkjet printer and in visual foxpro the memo fields r making some problem so i'm switching over to vb
how do i do it
0
Comment
Question by:leenapedenekar
3 Comments
 
LVL 3

Accepted Solution

by:
Phoenixric earned 45 total points
ID: 10993156
HI,

Maybe the problem is not on the language you are using but on your reporting tool or on how you generate the report. Why is it in labels cannot be made bold in FoxPro? Anyway. .

In VB, creating the simpliest report in form of data reports also requires knowledge in ADO to connect in foxPro 2.5 .

You might as well use DAO as your connection to foxpro 2.5 which is much simplier, but tedious when using the data report, cause data report is ideally build for ADO. Crystal report is ideal for this and also much easier to understand.

You can choose between this options:

Database Coonection Using :                    Report Tool:
ADO                                                      DATA Report, Crystal Report
DAO                                                      Crystal Report

Try this out:
Telling VB About ADO

1 Start a new project . Now go into the menu Project | References dialog and add theMicrosoft ActiveX Data Objects 2.0 Library andActiveX Data Objects Recordset 2.0 Library references to your project. Now VB 6.0 knows about the ADO components we want to use.
2. Then right click on your tool palette and select Components. Select theMicrosoft ADO Data Control 6.0 (OLEDB):
3. Double on you tool pallete ADODC control

Sample code for ADO connecting to Foxpro 2.5
4.)
Private Sub Form_Load()
Dim rs As ADODB.Recordset, cnFox As ADODB.Connection
Set cnFox = New ADODB.Connection
cnFox.ConnectionString = "Driver={Microsoft Visual FoxPro Driver}; SourceType=DBF; SourceDB=c:\; Exclusive=No;"

cnFox.Open
Set adodc1.DataSource = cnFox.Execute("select * from YourDBFile")
adodc1.Refresh
adodc1.Recordset.Addnew
adodc1.Recordset![P_Name] ="MyName"
adodc1.Recordset![Valid] = "YES"
adodc1.Recordset.Update
cnFox.Close
End Sub

5.  Then right click on your tool palette and select Crystal Report Control
     You have to install Crystal Report 8.0 or later version abcourse.
6.  Drag The Crystal Report Control on the form.
7.  Add the following code, on the Private Sub Form_Load()
    CrystalReport1.Destination = 1
    CrystalReport1.ReportFilename='C:\MyReport.rpt"
    CrystalReport1.Action = 1
8. You to connect your database on the Crystal Report designer. .  
Note:
You'll have to download the Microsoft Jet 4.0 Service Pack 3
And install it.

Hope this helps.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now