LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default create a mdb databse and a table and add records from Excel VBA

I need to createa new database called db.mdb that will contains a table call
tb with a few fields (field1, field2, field3).
Then, I need to be able to add records in this table. Later in my program, I
need to run an SQL query that will returns all records if field1 is = to "X"
(then I need to list the resulting data)
I have many topics about my questions but never managed to make it work.

I have used the following example to create the database :

strDB = "D:\db.mbd" ' Create new instance of Microsoft Access.
Set appaccess = CreateObject("Access.Application")
appaccess.NewCurrentDatabase strDB
Set dbprinter = appaccess.CurrentDb
Set tbprinter = dbprinter.CreateTableDef("tb")

With tbprinter
.Fields.Append .CreateField("filed1", DB_Text)
.Fields.Append .CreateField("filed2", DB_Text)
.Fields.Append .CreateField("filed3", DB_Text)
End With
db.TableDefs.Append tb
db.Close

The database and the table is created fine, but how do I creates records and
then run my queries (the information to fill the querry is coming from a list
from LDAP) ? is there another better method to create the database and the
table (I'm under Excel2003, XP)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create new excel table with filtered records from another table Berne van de Laar Excel Worksheet Functions 3 July 3rd 06 12:14 AM
Creating a databse from several Excel files JS Excel Discussion (Misc queries) 0 June 29th 06 02:39 PM
Making A Databse system on Excel? Lwotton Excel Discussion (Misc queries) 2 January 4th 05 03:27 PM
How can I get all table names from MS Access databse Mlaky[_2_] Excel Programming 3 February 18th 04 09:28 AM
Create a Databse using VBA Michael Rekas Excel Programming 0 August 23rd 03 04:42 PM


All times are GMT +1. The time now is 01:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"