Form using multiple dbfs?

Form using multiple dbfs?

Post by 43fa » Sat, 24 Jan 2004 00:52:59


Ok, I think I've "solved" the subform problem I was having, somewhat anyway.
I'm converting a form/screen from Access to VFP. For one of the subforms, I
was able to use a grid object, and it works great! Well, at least so far
anyway, haven't really done that much with it to see if there will be any
problems.

The other subform that was on the Access form though, presents a problem. I
can't have it in a grid format. So I figured, ok, just put the dbf in the
data environment, drag the fields onto the form, and go at it. Well, that
doesn't move the record pointer in this new subform. So then I figured, ok,
set a relation in the data environment, both dbfs have a key field named
File_no. That doesn't do it either!

So ok, how do I go about this?

I'll be getting into buttons, etc, here shortly, and I know I should
probably be creating classes for some of this stuff, but for right now, with
so little experience/knowledge in OOP, I think I'm better off writing the
code specifically for what I want to do. Might not be following the
standard, but since when are programmers "standard" anyway? ;) Anyway, I'm
sure I'll have questions on the buttons then too. :)




--
It's not just based on number of championships won. Richard Petty won
200 races and 7 Daytona 500s in his 30+ year driving career. He also has
the most top-5s (555), top-10s (712), poles (126), laps completed
(307,836), laps led (52,194), races led (599) and consecutive races won
(10 in 1967) of any driver in NASCAR history.
 
 
 

Form using multiple dbfs?

Post by Cindy Wine » Tue, 27 Jan 2004 00:43:16


Hi,

You've got two tables, with one being the "parent" and one the "child," and
they are realted by File_no. For each record in the parent table, how many
records are in the child table? For your form to work correctly they would
have to be 1-to-1; otherwise you wouldn't be able to see all the child
records since they're not shown in a grid.

I created a form and added two tables (Northwind Customers and Orders) to
the data environment. The relation between them showed up automatically
because it's a persistent relationship, set in the DBC. I dragged Customers
onto my form in grid format and also dragged Orders onto my form in grid
format. When I ran the form and stepped through Customers, the orders for
each customer showed automatically in the Orders grid.

Do you have a persistent relation between your two tables shown in the DBC
itself? What happens if the relation is set in your form's DE _before_ you
drag anything onto the form?


There are lots of buttons and button groups in the FoxPro Foundation Classes
(mine are in C:\Program Files\Microsoft Visual FoxPro 8\Ffc\). When you use
them you can add your own code that will run in addition to (use
DoDefault()) or instead of (no DoDefault) the code in the FFC button
classes. You're right though, perhaps the least confusing thing is for you
to use a button from the Form Controls toolbar and then code it yourself.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
XXXX@XXXXX.COM www.cindywinegarden.com

 
 
 

Form using multiple dbfs?

Post by 43fa » Wed, 28 Jan 2004 02:08:36

indy,

I wasn't refreshing the form, although, if I do it the way you're talking, I
probably don't need to. What had happened was, I had created a Next and
Previous button, and just did a skip and skip-1 with each. The data in the
grid updated with each move of the parent record, but actually, the parent
data, nor the data that I had on the screen from a third db, ever updated.
I was attempting to use "show gets".. which didn't make anything happen.
Once I found the ThisForm.Refresh, everything works fine.

I still need to create a "lookup" form, to allow the user to lookup, or
create a new set of records, based on the file number. And, I'm still
having problems with the report I need to print.

I think I need to go buy the book that someone mentioned here, I can't
remember the name right now, but it has to do with Visual Foxpro reporting.
:)

Thanks!
Shawn

"Cindy Winegarden" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
and
Customers
Classes
use


 
 
 

Form using multiple dbfs?

Post by Cindy Wine » Wed, 28 Jan 2004 09:21:08


You're thinking of Cathy Pountney's book:
http://www.yqcomputer.com/

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
XXXX@XXXXX.COM www.cindywinegarden.com