Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-08-09
5
Medium Priority
?
170 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 1500 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

Industry Leaders: 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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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

715 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