Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • Last Modified:

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

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
Anderson_Enterprises
Asked:
Anderson_Enterprises
  • 4
1 Solution
 
samopalCommented:
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
 
Anderson_EnterprisesAuthor Commented:
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
 
Anderson_EnterprisesAuthor Commented:
oh yea, i'd like to get the data like this..

MyVariable = MyTable("MyField")
0
 
Anderson_EnterprisesAuthor Commented:
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
 
Anderson_EnterprisesAuthor Commented:
Msgbox(Data1.RecordSet.Fields("MyField"))
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now