Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: subhankar pandey
  Where is subhankar pandey?
 Kolkata/Delhi
 India
 subhankar pandey
 Tags
Subject: Create same structure to MDB file
Thread ID: 228476 Message ID: 228476 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: Microsoft Office Automation
Date: Tuesday, May 19, 2009 9:43:31 AM         
   


Hi,

I'm in the process to create a table in MS-Access which suppose to be same structure VFP table. But not save the table in MS-Access. Below is my code:-

Use MyTable in 0 Excl
Select MyTable
gnFieldcount = AFIELDS(gaMyArray)  && Create array
lcPath=GETFILE('MDB', 'MDB TableName:', 'Create', 1,'Create a New File in Access')
oAccess=CreateObject("Access.Application")
oMDB = oAccess.NewCurrentDatabase(lcPath)
oTable = oAccess.CurrentDb.CreateTableDef(Alias())
FOR nCount = 1 TO gnFieldcount 
	lFldType=IIF(gaMyArray(nCount,2)="C",10,8 )
	lfldSize=IIF(gaMyArray(nCount,3)>0,gaMyArray(nCount,3),255 )
	loField=oTable.CreateField(gaMyArray(nCount,1), lFLDType, lFLDSize)
	oTable.Fields.Append(loField)
	oTable.Fields(gaMyArray(nCount,1)).AllowZeroLength = .T.
ENDFOR
oAccess.CurrentDB.TableDefs.Append(oTable)
oAccess.CurrentDB.TableDefs.Refresh
Release gaMyArray
oAccess.Visible=.T.
Store Null to oaccess,otable,oMDB
Return

Am I missing something to save the structure in Ms-Access?

Thanks in advnace.

regards
Subhankar

ENTIRE THREAD

Create same structure to MDB file Posted by subhankar pandey @ 5/19/2009 9:43:31 AM
RE: Create same structure to MDB file Posted by Andy Kramek @ 5/19/2009 12:34:58 PM
RE: Create same structure to MDB file Posted by subhankar pandey @ 5/19/2009 1:45:58 PM