Solved

accessing foxpro free table from visual basic

Posted on 2004-04-29
3
250 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

733 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