带按钮的项目数组 [英] Array of items with buttons

查看:132
本文介绍了带按钮的项目数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对MS Access(2007)还是陌生的,我有一个很快的问题。我正在构建一个表单,该表单旨在帮助您在不断变化的时间表上输入数据。

I'm fairly new to MS Access (2007) and I have a quick question. I am building a form that is meant to help aid data entry on a changing schedule.

因此,我希望该表单如下工作。首先,用户输入他当天要记录的卡车数量。该表格将按时间表抓取第一批X辆卡车,并为每辆卡车创建一个物品。由于时间表可以更改,因此每个项目都有一个向上/向下箭头,可以在时间表周围移动它。 空线组实际上是按钮的标题,创建后将其更改为卡车的标识符。按下按钮会将用户带到另一表格来输入该卡车上的数据。

So I would like the form to work as follows. First the user enters in the number of trucks he will be recording that day. The form would grab those first X trucks off a schedule and create an item for each truck. Since the schedule can change, each item has an up/down arrow to move it around the schedule. The "Empty Lineset" is actually the caption of a button that would be changed to the truck's identifier when created. Pressing the button would bring the user to a different form to enter data on that truck.

想法是让它看起来像这样:

The idea is for it to look something like this:

我的问题是-是否有创建方法一个数组或功能类似这些项目的数组。因此,如果用户当天输入了6辆卡车,则将创建其中6辆卡车。

So my question is - Is there a way to create an array or something functionally like an array of these items. So if the user entered 6 trucks for the day, it would create 6 of these truck items.

像这样的数组的想法很酷,但是我不确定如何去创建它。如有任何想法或建议,请告诉我。

The idea of an Array of items like this is pretty cool, but I'm not sure how to go about creating it. If anyone has any ideas or suggestions, please let me know.

谢谢大家

推荐答案

您应该能够创建他们所谓的控件数组。以下是一些示例代码,应该可以帮助您入门:

You should be able to create what they called a control array. Here's some example code that should get you started:

Private Sub UserForm_initialize()
Dim TBarray(0 To 5) As Control
Dim i As Integer
Dim intTop As Integer

intTop = 0
For i = 0 To 5
Set TBarray(i) = Controls.Add("Forms.TextBox.1", "TextBox" & i)
TBarray(i).Top = intTop + 20
TBarray(i).Text = "Name: " & TBarray(i).Name
intTop = intTop + 20
Next i

End Sub 

我之前已经做过,但是这里的代码来自:此处

I've done this before, but the code here is from: here

这篇关于带按钮的项目数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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