473,397 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Create Access table using VB6 code

Hello guys,

im having trouble with this line of code. I'm trying to create a table in access using this piece of code but it says 'Object is no longer valid.' and it points to ocat.Tables.Append otbl. How can I solve this error guys?

Heres the code:

Dim otbl As New ADOX.Table
Dim ocat As New ADOX.Catalog

otbl.Name = "Table1"
otbl.Columns.Append "strItemCode", adChar
otbl.Columns.Append "strItemName", adChar
otbl.Columns.Append "intTotalQty", adInteger
otbl.Columns.Append "intPullOut", adInteger
otbl.Columns.Append "intTotalAmt", adInteger '
ocat.Tables.Append otbl
Feb 27 '08 #1
5 2588
debasisdas
8,127 Expert 4TB
try using this
Expand|Select|Wrap|Line Numbers
  1. ocat.ActiveConnection = con   ''your connection object
  2. otbl.ParentCatalog = ocat
  3.  
might help you.
Feb 27 '08 #2
try using this
Expand|Select|Wrap|Line Numbers
  1. ocat.ActiveConnection = con   ''your connection object
  2. otbl.ParentCatalog = ocat
  3.  
might help you.
I already put the code but it says ''Type is invalid" and points to ocat.Tables.Append otbl...

I think I have put otbl.Type=?????

What kind of type is that? And what does otbl.ParentCatalog means?
Feb 27 '08 #3
Okay.. I have solved my problem.. i just put set otbl = new ADOX.Catalog and it works! Now my problem is, how to set its Default Value=0?? Any suggestions sir?
Feb 27 '08 #4
debasisdas
8,127 Expert 4TB
Default Value Of What ?
Feb 27 '08 #5
Default Value Of What ?
Hehe.. i already solve my problem :
Expand|Select|Wrap|Line Numbers
  1. otbl.Columns("intTotalQty").Properties("Default") = 0
  2. otbl.Columns("intPullOut").Properties("Default") = 0
  3. otbl.Columns("intTotalAmt").Properties("Default") = 0
  4.  
Thanks for giving a little idea sir.. :)
Feb 27 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Lauren Quantrell | last post by:
Is there a way to create a text file (such as a Windows Notepad file) by using a trigger on a table? What I want to do is to send a row of information to a table where the table: tblFileData has...
4
by: intl04 | last post by:
How do I create a data input form in Access that is external to the Access database to which it's connected (if that's possible, which I believe it is)? For example, if someone clicks on an Access...
8
by: Brian S. Smith | last post by:
Hi gang, Please help. I've been through the Access help, searched the Web, and I can't seem to get a straight answer. As the Subject line suggests, I want to run a fairly simple VB/Access Sub...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
3
by: Kent | last post by:
I am try to link a SQL 2000 table to Access 2000 using VB.Net 2003 Here is my code: Dim Con As New ADODB.Connection Dim Cat As New ADOX.Catalog Dim tbl As New ADOX.Table ...
4
by: Wayne Wengert | last post by:
I am trying to create a VB.NET Windows application to move some data from a local Access DB table to a table in a SQL Server. The approach I am trying is to open an OLEDB connection to the local...
10
by: Minh | last post by:
I search in all the Disscussion but can not found. How can I create a MS Access Database file using C# code with a given Table Structure ? For example, I want to create a Access Database File...
27
by: max | last post by:
Hello, I am a newbye, and I'm trying to write a simple application. I have five tables with three columns; all tables are identical; I need to change some data in the first table and let VB...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
12
by: tekctrl | last post by:
Environment; Win2K PC with 1Gb of RAM and plenty of HD space running Access 2002 Issue; Access presents a blank data entry form in the Forms view when the New Record icon is used. However, it...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.