Solved

Creating Tables in VB

Posted on 1998-07-28
3
144 Views
Last Modified: 2010-05-03
How do you create a Table in Visual Basic?  We have a database at work that was created in VB.  Whenever we need to create a table, it looks fine until we go back in and view it.  At this point, the rows and columns have shifted and sometimes you can't even tell it was a table.

Please help.  Thank you.
0
Comment
Question by:Pebbles
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
Dalin earned 100 total points
Comment Utility
Pebbles,
Try this. Let me know if you have questions
Regards
Dalin

Dim mydb as Database
Dim MyTD as TableDef
Dim MyField1 as Field

Set MyDB = DBEngine.WorkSpaces(0).Opendatabase("YourDBwithPath")
Set myTD = myDB.CreateTableDef("YourTableName")
Set MyField1=MyTD.CreateField("YourFieldName", dbInteger) 'assume integer

'if you want to create more filed, go here
MyTD.Fields.Append MyField1
'...
MyDB.Tabledefs.Append MyTD
MyDb.Close
Now you created the table, just fill it with data


0
 

Author Comment

by:Pebbles
Comment Utility
After I give this response to our programmer at work, I may be able to rate this higher.  As a user inputting information, I wouldn't know how to do this.

What we do is go into our VB database.  There is also a Word 6.0 document behind the screen.  We put our information into the Word document and then copy and paste it into the Database.  It is then that we see that VB did not accept our tables in the format we created them.  

So, I guess, more to the point:  we never know when a table is needed.  Is there something we, as users, can do OR must we notify our IS area every time we want to create a table so that they can code it as your directed above?

I'm new to this and really do appreciate your help.
0
 

Author Comment

by:Pebbles
Comment Utility
After I give this response to our programmer at work, I may be able to rate this higher.  As a user inputting information, I wouldn't know how to do this.

What we do is go into our VB database.  There is also a Word 6.0 document behind the screen.  We put our information into the Word document and then copy and paste it into the Database.  It is then that we see that VB did not accept our tables in the format we created them.  

So, I guess, more to the point:  we never know when a table is needed.  Is there something we, as users, can do OR must we notify our IS area every time we want to create a table so that they can code it as your directed above?

I'm new to this and really do appreciate your help.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now