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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP6.0 How to set up dafualts of a column in fox pro

Status
Not open for further replies.

2969

IS-IT--Management
Oct 18, 2001
107
US
hi

I would like to define defaults for a column in a table in vfp6.0 using VB.

What is the syntax of the code that would define the defaults for the column using VB.
 
I am a VFP developer (not VB) so you will have to take my close code and make it better <g>.

Code:
dim oVFP
oVFP = CREATEOBJECT "VisualFoxPro.Application"
oVFP.DoCmd("open database D:\FullPathHere\MyData.DBC")
oVFP.DoCmd("ALTER TABLE MyTable ALTER COLUMN MyColumn SET DEFAULT 'OH'")
oVFP.DoCmd("use in MyTable")

You will need exclusive use of the database table you are altering the column default values.

(So, how many VFP developers are going, crud, I did not think anyone could alter my structures unless they had a copy of VFP?)


_RAS
VFP MVP
 
Rick,
Actually I believe they will need a copy of VFP or they won't have "VisualFoxPro.Application" to be able to use this automation script. (I'm sure that you really do know that, and are just baiting someone like me to respond! :))

Rick

 
Rick and Rick,

If they don't have a copy of VFP, could they not do the same thing via ODBC? In other words, get an ODBC connection to a VFP database and send an ALTER TABLE command?

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Rick,

... and the ALTER table would seem to be much different.


True, but come to think of it, they could presumably just send an ALTER TABLE command via the VB equivalent of SQLEXEC(), assuming VB has such a facility.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
VB uses ADO which can execute SQL commands, so this should be very possible as long as VFP's ODBC or OLE DB supports the process.

It might be cheaper just to buy a copy of VFP and use the Table Designer, or hire someone who has it and have them modify the default values.


_RAS
VFP MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top