在 MS Access 表单中动态添加组合框
我正在尝试在 MS Access 中创建一个表单。 最初我只有一个组合框。 我的要求是我有“添加”按钮,如果我单击此按钮,这应该动态地将组合框一个一个地添加到另一个组合框下面。
我的实际需求如下: 我设计了这个表格,就像投标回复表格一样。
通常投标会有日期、项目描述、数量等......
我使用 date() 函数得到了这个日期。 但是该项目描述已经在数据库中,但可能存在向数据库添加新项目的情况。如果是新的,我必须从中获取或添加到其中。
我的解释清楚吗?请帮助大家,
我想要的是:想要使用组合框来添加到数据库以及从数据库中获取。
但从组合框向数据库插入值不应删除旧记录
谢谢, 尚穆根
I'm trying to create a form in MS access.
Initially i will have only one combo box.
My requirement is i have "Add" button if i click on this button this should dynamically add Combo boxes one below another.
My actual requirement is as follows:
I designed this form like tender reply form
Usually a tender will have date, Item descriptions, quantity etc....
I have got this date using date() function.
But this Item descriptions are already in database but there may be situations to add new item to database . I have to fetch from it or add into it if its new.
Am i clear with my explanations? Please help guys
exact thing i want is : wanna use a combo box for both, to add to database as well to fetch from database.
but inserting value to DB from combo box should not delete old record
Thanks,
Shanmugam
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将 CreateControl 方法与 acComboBox 结合使用(值 = 111)作为控件类型。
如果您希望新的组合框出现在最后一个组合框的下方,则需要确定最后一个组合框的位置,以便计算适当的 .left 和 .top 新属性。
但在运行时创建组合会产生相当多的开销。为了使其有用,您需要设置许多其他属性,包括:行源类型;行源;绑定柱;控制源(如果它将是绑定组合);列数;列宽。或许还有更多。这项任务比乍一看更复杂,并且有很多出错的机会。
就我个人而言,我从未找到过值得付出努力的情况。但我并不是说这对你的情况没有意义。
Use the CreateControl Method with acComboBox (value = 111) as control type.
If you want the new combo box to appear below the last, you'll need to determine the position of the last one so you can then compute the appropriate .left and .top properties for the new one.
But there will be considerably more overhead to create a combo at runtime. In order for it to be useful, you will need to set a host of other properties, including: Row Source Type; Row Source; Bound Column; Control Source (if it will be a bound combo); Column Count; Column Widths. And probably still more. This task is more complicated than it may seem at first blush, and there are many opportunities for errors.
Personally, I've never found a situation where it seemed worth the effort. But I don't mean to imply it doesn't make sense in your situation.