Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I'm working with a Foxpro 6.0 datab 1

Status
Not open for further replies.

parkfairfax

Programmer
May 22, 2001
63
US
I'm working with a Foxpro 6.0 database. In Access, you can change your query to a make table query. Can anyone tell me whether this can be done in Foxpro, I cannot seem to find this option.

Thanks,

Garry Miller
 
Garry,
It's always best to define exactly what you want to do - many of us aren't that familar with Access (or VB).

If the question is you want a limited number of records from the table that are still updatable, then you'll want to use an updateable local view. This is similar to a readonly "query", but it does carry some overhead and must be stored in a DBC.

Rick
 
Rick,

Thanks for your reply. I have 2 tables in Foxpro. In a reference book that I'm using ("Visual Foxpro Enterprise Development) there is a sentence under a section entitled Using SQL Update that says.."You cannot update records using a join condition". I find that partly hard to believe since this is very commonly done in Access, and something that I quite frankly use often.

I have 2 tables each with a device_id column. I would like to update all of the certain values in table A, field7 with those matching values of field 7 in table B where the device_id column in both tables are equal.

This seems like a very basic concept to me, but according to my book this cannot be done. Is this true? How would you get around this?

Thanks,

Garry
 
I can't be positive, but I think they mean that you can't change the field you're doing the join on. I'm sure you can change the value of other fields. -- DED
 
Gary,
I believe you'll just need to do an extra step that Access hides from you - create the local view then do the SQL Update on it. While I only have the VFP 5.0 version of that book, check the chapter on Creating a Visual FoxPro Database, and go to the Views section. Note: In the filter section you can set the Example to a ? and it will ask for a value at runtime. Or if you enter a ?<variable> it will use this value (known as a parmeterized view). Then run the update on the View (it's all &quot;filtered&quot; for you <g>).

(Access hides a lot of the details. The most infamous is the report writer's &quot;automatic&quot; two pass technique that allows it to print &quot;page of total pages&quot;. In FoxPro, you've got to maually run the report twice to provide this feature.)

Rick
 
Okay, Rick. Thanks very much for your help. This all sounds logical and I'm sure it will work.

Regards,

garry miller
 
Rick,

I have started looking at views. The concept is fairly clear to me, but I'm having trouble getting started. Can you create views between 2 free tables, or do you have to have your tables in a database? I keep getting errors like &quot;No database open set as current database&quot;. When I go to New from File menu, and try to select view the VIEW option, it is not highlighted.

Thank you,

garry miller
 
Garry,
Since the View (actually all the information that defines it) is stored in the database, you will need to have a database (.DBC) open, but the tables themselves don't have to be in the .DBC - they can be free tables (VFP or even FP 2.x).

So open (or create) a Database, and then you can use the view designer to create the view.

Rick
 
And likewise, of course, you can create a Remote View using anything you can get an ODBC driver for (including text files). -- DED
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top