热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

具有可变数量的列的VBAAccess2003表-VBAAccess2003tablewithavariablenumberofColumns

IhaveatableinAccess2003VBAwith164columnsbutthedataIgethas181columnanditispossi

I have a table in Access 2003 VBA with 164 columns but the data I get has 181 column and it is possible that it will get bigger in the future. I need to know how to resize my table an to add extra colums during the runtime I know how to check how many colums I need so I just need to know how to resize my own table.

我在Access 2003 VBA中有一个包含164列的表,但我得到的数据有181列,未来它可能会变大。我需要知道如何调整表格大小以在运行时添加额外的列我知道如何检查我需要多少列,所以我只需要知道如何调整我自己的表。

thanks

7 个解决方案

#1


3  

Another option; rather than have a "short-fat" table with lots of columns, have a "tall-skinny" table with lots of rows:

另外一个选项;而不是有一个有很多列的“短胖”表,有一个“高瘦”表,有很多行:

Short-fat:

   ID
   FirstName
   LastName
   ...
   Amount

   1 Joe Smith   ... $123
   2 Bob Roberts ... $214
   3 Jim Black   ... $500

Tall-skinny:

   RecordID
   FieldNumber
   FieldName
   FieldValue

   1 1 FirstName Joe
   1 2 LastName  Smith
   ...
   1 n Amount $123
   2 1 FirstName Bob
   2 2 Lastname  Roberts
   ...
   2 n Amount    $214
   3 1 FirstName Jim
   3 2 LastName  Black
   ...
   3 n Amount    $500

This is good if you have a "stand alone" table that doesn't have to join with other tables, otherwise you're in for a world of pain.

如果你有一个“独立”表,不必与其他表连接,这是很好的,否则你将陷入痛苦的世界。

#2


3  

There is not much to base this on, but it sounds like a design problem. I would look at the data that is driving these additional columns and see if you can create a column to store it.

没有太多基础,但这听起来像一个设计问题。我会查看驱动这些附加列的数据,看看是否可以创建一个列来存储它们。

If the data is really that volatile, i would consider creating a new table with Key, FieldName, FieldValue as your columns. This way you wont have to change your reports, queries, import routines every time the data changes.

如果数据真的那么易变,我会考虑创建一个新的表,其中Key,FieldName,FieldValue作为您的列。这样,每次数据更改时,您都不必更改报表,查询和导入例程。

#3


2  

I don't have the reputation to comment, but to extend the short-fat vs long-skinny argument, i think its a good idea to start there. then you can create a crosstab query using the field that has the old field names as the column header. then write a make-table off of that query and you will have your table.

我没有评论的声誉,但是为了扩展短发和长期紧张的论点,我认为从一开始就是一个好主意。然后,您可以使用具有旧字段名称作为列标题的字段创建交叉表查询。然后从该查询中写下一个make-table,你将得到你的表。

#4


1  

Might be something here. I'd probably create a new table based on the old one, and with the extra columns from data source. Then I'd populate the new table from the two data sources. I'd do this if for no other reason than it means I keep the old data safe while making the new.

可能是这里的东西。我可能会根据旧表创建一个新表,并使用数据源中的额外列。然后我将从两个数据源填充新表。如果没有其他原因,我会这样做,这意味着我在制作新数据时保持旧数据安全。

#5


1  

If you are stuck with this poor design, you can use SQL to add columns as you need them:

如果您遇到这种糟糕的设计,可以使用SQL根据需要添加列:

strSQL="ALTER TABLE tblTable ADD COLUMN NewCol Text (25)"
CurrentDB.Execute strSQL,dbFailOnError

Or you can use the TableDef.

或者您可以使用TableDef。

#6


0  

the problem is that i don't have the rights to change the design the complete database is already created my job is just to impiment the reading of csv data but these dam... data need more colums than there were implimented by the previos programmer thats why i can't just delete the table and besides there are about 30 or 40 tables like the one i describet in the question thats why i asked for some kind of algorithm to change the amount of columns

问题是我没有权利改变设计已经创建了完整的数据库我的工作只是为了破坏csv数据的读取,但这些大坝...数据需要更多的colums而不是previos程序员所表示的这就是为什么我不能只删除表,而且还有大约30或40个表,就像我在问题中描述的那个,这就是为什么我要求某种算法来改变列的数量

but thanks for the fast awnser

但感谢快速的芒果

#7


0  

So are you looking for VB/VBA code to alter the table in the MDB? It sounds like that's what you're after -- something automated based on the incoming data. If you don't have permissions on the MDB file that's going to be hard to do, but I think what you're really saying is that you don't have the option to open the MDB in Access and modify it.

那么你在寻找改变MDB表的VB / VBA代码吗?这听起来就是你所追求的 - 基于传入数据自动化的东西。如果你没有MDB文件的权限,那将很难做到,但我认为你真正说的是你没有选择在Access中打开MDB并修改它。


推荐阅读
  • 基于KVM的SRIOV直通配置及性能测试
    SRIOV介绍、VF直通配置,以及包转发率性能测试小慢哥的原创文章,欢迎转载目录?1.SRIOV介绍?2.环境说明?3.开启SRIOV?4.生成VF?5.VF ... [详细]
  • 使用 Azure Service Principal 和 Microsoft Graph API 获取 AAD 用户列表
    本文介绍了一段通用代码示例,该代码不仅能够操作 Azure Active Directory (AAD),还可以通过 Azure Service Principal 的授权访问和管理 Azure 订阅资源。Azure 的架构可以分为两个层级:AAD 和 Subscription。 ... [详细]
  • 深入解析Spring Cloud Ribbon负载均衡机制
    本文详细介绍了Spring Cloud中的Ribbon组件如何实现服务调用的负载均衡。通过分析其工作原理、源码结构及配置方式,帮助读者理解Ribbon在分布式系统中的重要作用。 ... [详细]
  • DNN Community 和 Professional 版本的主要差异
    本文详细解析了 DotNetNuke (DNN) 的两种主要版本:Community 和 Professional。通过对比两者的功能和附加组件,帮助用户选择最适合其需求的版本。 ... [详细]
  • ImmutableX Poised to Pioneer Web3 Gaming Revolution
    ImmutableX is set to spearhead the evolution of Web3 gaming, with its innovative technologies and strategic partnerships driving significant advancements in the industry. ... [详细]
  • 深入解析 Apache Shiro 安全框架架构
    本文详细介绍了 Apache Shiro,一个强大且灵活的开源安全框架。Shiro 专注于简化身份验证、授权、会话管理和加密等复杂的安全操作,使开发者能够更轻松地保护应用程序。其核心目标是提供易于使用和理解的API,同时确保高度的安全性和灵活性。 ... [详细]
  • 本文介绍了Android开发中Intent的基本概念及其在不同Activity之间的数据传递方式,详细展示了如何通过Intent实现Activity间的跳转和数据传输。 ... [详细]
  • 本文深入探讨了HTTP请求和响应对象的使用,详细介绍了如何通过响应对象向客户端发送数据、处理中文乱码问题以及常见的HTTP状态码。此外,还涵盖了文件下载、请求重定向、请求转发等高级功能。 ... [详细]
  • 雨林木风 GHOST XP SP3 经典珍藏版 V2017.11
    雨林木风 GHOST XP SP3 经典珍藏版 V2017.11 ... [详细]
  • 本文探讨了如何通过一系列技术手段提升Spring Boot项目的并发处理能力,解决生产环境中因慢请求导致的系统性能下降问题。 ... [详细]
  • 本文详细探讨了在微服务架构中,使用Feign进行远程调用时出现的请求头丢失问题,并提供了具体的解决方案。重点讨论了单线程和异步调用两种场景下的处理方法。 ... [详细]
  • Active Object设计模式解析
    Active Object设计模式通过引入代理(Proxy)和命令(Command)模式,实现了方法调用与执行的解耦,从而支持异步操作和提高系统的并发处理能力。本文将深入探讨Active Object模式的工作原理及其应用场景。 ... [详细]
  • 本文探讨了在支付项目开发中使用SS5 Socket Server实现内部网络访问外部网络的技术方案。详细介绍了SS5的安装、配置及性能测试过程,旨在为面临相同需求的技术人员提供参考。 ... [详细]
  • Netty基础教程:构建简易Netty客户端与服务器
    Java NIO是解决传统阻塞I/O问题的关键技术之一,但其复杂性给开发者带来了挑战。Netty作为一个成熟的网络编程框架,极大地简化了这一过程。本文将通过一个简单的示例,介绍如何使用Netty创建基本的客户端和服务器。 ... [详细]
  • IhavethistableinExcel:我有一张Excel表格:andIhavethefollowingformulaincolumnN:第N列有如下公式: ... [详细]
author-avatar
吾爱九-九九
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有