Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need to create table from SQL statement
Message
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00260379
Message ID:
00261319
Views:
28
No. I was hoping to do the following in VB as I have done in MS Access, VFP, & CBuilder:

SELECT cBattery, lRetired, tInService, iBatteryIDType, cModel, tblModel.cCode AS mcCode, cCodeDefault, cC7Adapter, cUsedIn, cManufacturer, cCustomerName, iServiceID AS iOrigiServiceID, tCreated, iBatteryStatus, iDisplayStatus, iFinalCapacity, iFinalImpedance, iCycleCount, mCapacities, mImpedances, tblService.cCode AS scCode, iTargetCapacity, iChargeCycles, iDischargeCycles, iReconditionCycles, tEnded, cProgramName
INTO tblTemp IN 'D:\SiteMonitor\Source\ExportFile\Db\dbTemp.mdb'
FROM tblBattery, tblModel, tblManufacturer, tblCustomer, tblService, tblProgram
WHERE tblModel.iModelID = tblBattery.iModelID AND
tblModel.iManufacturerID = tblManufacturer.iManufacturerID AND
tblCustomer.iCustomerID = tblBattery.iCustomerID AND
tblService.iBatteryID = tblBattery.iBatteryID AND
tblService.iProgramID = tblProgram.iProgramID;


>Use the "Create Table" SQL query. It will be a lot easier for you to port your application to something else than DAO later.
>
>This sample is taken from MS-Access help.
>
>This example creates a new table called ThisTable with two Text fields.
>
>Sub CreateTableX1()
>
> Dim dbs As Database
>
> ' Modify this line to include the path to Northwind
> ' on your computer.
> Set dbs = OpenDatabase("Northwind.mdb")
>
>' Create a table with two text fields.
>
>dbs.Execute "CREATE TABLE ThisTable " _
> & "(FirstName TEXT, LastName TEXT);"
>
> dbs.Close
>
>End Sub
>
>This example creates a new table called MyTable with two Text fields, a Date/Time field, and a unique index made up of all three fields.
>
>Sub CreateTableX2()
>
> Dim dbs As Database
>
> ' Modify this line to include the path to Northwind
> ' on your computer.
> Set dbs = OpenDatabase("Northwind.mdb")
>
> ' Create a table with three fields and a unique
> ' index made up of all three fields.
> dbs.Execute "CREATE TABLE MyTable " _
> & "(FirstName TEXT, LastName TEXT, " _
> & "DateOfBirth DATETIME, " _
> & "CONSTRAINT MyTableConstraint UNIQUE " _
> & "(FirstName, LastName, DateOfBirth));"
>
>dbs.Close
>
>End Sub
>
>This example creates a new table with two Text fields and an Integer field. The SSN field is the primary key.
>
>Sub CreateTableX3()
>
> Dim dbs As Database
>
> ' Modify this line to include the path to Northwind
> ' on your computer.
> Set dbs = OpenDatabase("Northwind.mdb")
>
> ' Create a table with three fields and a primary
> ' key.
> dbs.Execute "CREATE TABLE NewTable " _
> & "(FirstName TEXT, LastName TEXT, " _
> & "SSN INTEGER CONSTRAINT MyFieldConstraint " _
> & "PRIMARY KEY);"
>
> dbs.Close
>
>End Sub
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform