Solved

(VB6) ActiveX Control in FoxPro6. How do I connect to the data?

Posted on 2004-08-09
5
168 Views
Last Modified: 2010-05-02
I created an ActiveX Calendar Control in VB. (Because all the other ones are ugly)

Everything is going great... Except the fact that it's just pretty, and does nothing useful...

Project: Create an Inventory Management program using FoxPro6 (gag)
Current Task: Create a Calendar that shows the number of chairs instock on each day. (Vb6 ActiveX Custom Control, OCX)
Brick Wall: It looks pretty, but doesn't connect to the data.

The goal of the Calendar (and the real reason I made it in the first place) is to count up all the available items on a certain day and display the Inventory Status on each day in a month view.

<img src="http://winstormsolutions.com/myreallycoolcalendar.jpg">
(ignore the random button, that's my test database connection button..)

The calendar and internal math work great -- But use random data!

Assuming I know everything about VB worth knowing (Except Database connectivity) How in the world do I go about connecting to a FoxPro6 database. Here is the Catch -- I'd like to be able to reuse it. Adding a special property used this way:

(This is how i'd like for it to be used)

objCalendar.RecordType = "Fox Pro 6"
objCalendar.RecordSource = "Inventory!Category"
objCalendar.UpdateUI
Or whatever, but you get the idea. Maybe auto updating, or whatever.

I don't know which references i'd need, and i prefer not to have any extra required files. I'd prefer the program to work on Windows 95 WITHOUT MDAC 2.5 (or whatever we're up to now..)

I'd like to use the data control that comes with VB6.

The data is READONLY, I can't imagine the calendar changing anything, but if you can put together some two way street that'd be fine.

Name of the game is REUSABLE.. No hardcoding the paths or database types.

I'd give it a 5,000 rating, but I hear that's frowned upon..

Cheers,

-Michael Smyers
Anderson Enterprises
0
Comment
Question by:Anderson_Enterprises
[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
  • 4
5 Comments
 
LVL 9

Accepted Solution

by:
samopal earned 500 total points
ID: 11758386
1) Do you have any experience with FoxPro?
2) You need the way to pass data from main application (VFP) to your control. I see 3 choices :
- pass this data as string (or file) and parse it in VB control
- pass data as ADO recordset (and I prefer this)
- pass the link to your DBF database into VB control
last 2 options will require MDAC install on client computer

For the second option :

add objCalendar.RecordSource property as ADODB.Recordset into your control and build all calculations inside VB control based on this recordset

in VFP application select required data into cursor and use this sample from M$ to convert VFP cursor into ADODB recordset
http://download.microsoft.com/download/vfox60/samp3/1/WIN98/EN-US/RS2dbf.exe
After that just assign result ADO recordset to the RecordSource property of your control.

Hope This Helps,
D'Al
0
 

Author Comment

by:Anderson_Enterprises
ID: 11759091
Hmm, How do I go about doing 2.b

I prefer no extra step in the transfer of data. It needs to be smooth and easy.

I am accustomed to such things as:

myConn.Open ""
myConn.Execute ""

etc..
0
 

Author Comment

by:Anderson_Enterprises
ID: 11759098
oh yea, i'd like to get the data like this..

MyVariable = MyTable("MyField")
0
 

Author Comment

by:Anderson_Enterprises
ID: 11763362
I created an ODBC connection in the control panel, and then used JET to connect to it..

I'm going to award you the points, because I did get the answer reading along the suggested lines.

Thanks!
0
 

Author Comment

by:Anderson_Enterprises
ID: 11763370
Msgbox(Data1.RecordSet.Fields("MyField"))
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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month3 days, 19 hours left to enroll

630 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