?
Solved

Creating Tables in VB

Posted on 1998-07-28
3
Medium Priority
?
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
Dalin earned 200 total points
ID: 1467011
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
ID: 1467012
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
ID: 1467013
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 5 hours left to enroll

765 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