运行时错误'3251' - 尝试在VB6中链接表 [英] Run-time error '3251' - While trying to link a table in VB6

查看:168
本文介绍了运行时错误'3251' - 尝试在VB6中链接表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名VB6数据库程序员,遇到了一个小问题。我工作的公司主要使用Microsoft Access 2000作为我们软件的后端数据库。那么我目前正在处理的功能在一个数据库中创建一个表,然后将其链接到程序用来存储和检索数据的主数据库中。


这里'这是问题所在。我可以创建表格,但是当我链接表格时,我得到一个运行时错误,如下所示:
运行时错误''3251'':此类对象不支持操作。


我已经在互联网上找到了解决这个问题的方法,但似乎无法弄明白或想出一个更好的方法来完成我的工作我想做。我会继续发布我的代码,希望有人知道要解决的问题。


VB6代码:::::::

展开 | 选择 | Wrap | 行号

解决方案

虽然我从不使用dao或tabledef,但是这段代码的某些内容对我来说并不合适。我认为您通常会创建一个tabledef对象,然后将其附加到数据库中。之后,您可以设置其属性(请参阅这里)。我不认为你可以将tabledef设置为现有对象然后再次附加它。


此外你的函数没有返回类型或值。

<


更改
dbstemp.TableDefs.Append(tdf)


dbstemp.TableDefs.Append tdf



我是VB6数据库程序员并遇到过一个小问题。我工作的公司主要使用Microsoft Access 2000作为我们软件的后端数据库。那么我目前正在处理的功能在一个数据库中创建一个表,然后将其链接到程序用来存储和检索数据的主数据库中。


这里'这是问题所在。我可以创建表格,但是当我链接表格时,我得到一个运行时错误,如下所示:
运行时错误''3251'':此类对象不支持操作。


我已经在互联网上找到了解决这个问题的方法,但似乎无法弄明白或想出一个更好的方法来完成我的工作我想做。我会继续发布我的代码,希望有人知道要解决的问题。


VB6代码:::::::

展开 | 选择 | Wrap | 行号


I am a VB6 database programmer and have run into a small problem. The company I work for primarily uses Microsoft Access 2000 for the database that is the back end for our software. Well the functionality that I am currently working on creates a table in one database and then links it into the primary database that is used by the program to store and retrieve data from.

Here''s the problem. I can create the table fine but when I go to link the table I get a run time error as follows:
Run-time error ''3251'': Operation is not supported for this type of object.

I have looked all over the internet to find a solution to this problem but can''t seem to figure it out or figure out a better way of accomplishing what I am trying to do. I''ll go ahead and post my code and hopefully someone has an idea on what to fix.

VB6 Code:::::::

Expand|Select|Wrap|Line Numbers

解决方案

Although I never use dao or tabledef there is something about this code that does not look right to me. I think you would normally create a tabledef object and then append it to the database. After that you can set its properties (see here). I don''t think you can set the tabledef to an existing object and then append it again.

Also your function does not have a return type or value.


Got it!

Change
dbstemp.TableDefs.Append (tdf)
to
dbstemp.TableDefs.Append tdf


I am a VB6 database programmer and have run into a small problem. The company I work for primarily uses Microsoft Access 2000 for the database that is the back end for our software. Well the functionality that I am currently working on creates a table in one database and then links it into the primary database that is used by the program to store and retrieve data from.

Here''s the problem. I can create the table fine but when I go to link the table I get a run time error as follows:
Run-time error ''3251'': Operation is not supported for this type of object.

I have looked all over the internet to find a solution to this problem but can''t seem to figure it out or figure out a better way of accomplishing what I am trying to do. I''ll go ahead and post my code and hopefully someone has an idea on what to fix.

VB6 Code:::::::

Expand|Select|Wrap|Line Numbers


这篇关于运行时错误'3251' - 尝试在VB6中链接表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆