根据定义的确切单元格值(行和列)填充文本框 [英] Populating textboxes based on exact cell values (row and column) defined
问题描述
所以我在ID上创建了一个随机集的表。这意味着根据选择的ID号,我需要将表中的值填充到位于表单中的texbox中。
So I have a table created with a randomize set on the ID. Meaning that based on what ID number is chosen then I need values from a table to be filled into texboxes, which are located in a form.
这是一个测验类型的程序
It is a quiz type of program
意思是我有一个名为= TblOtazky的问题日志,我填写了所有问题
Meaning I have a question log called = TblOtazky where I have all the questions filled out
示例:
ID  问题                                                  
A1 A2                           
A3
ID question A1 A2 A3
1         它是一周中的哪一天? 周一                 周二                   
星期三
1 What day of the week is it? Monday Tuesday Wednesday
2          我有什么颜色的衬衫           &NBSP ;        红色                &NBSP ;      蓝色                  &NBSP ;     
绿色
2 What colour shirt do I have? Red Blue Green
....
表格打开后会生成一个唯一的号码(不会重复)
Once the form opens it generates a unique number (will not repeat)
含义:
ID: 1
ID : 1
基于此ID我希望它填充文本框
based on this Id I want it to populate the textboxes
Txt1(问题)
Txt2 (A1)
Txt3(A2)
Txt4(A3)
我当然可以这样做通过使用If并定义它,但问题是您必须更新代码而不是更新数据表:TblOtazky。
I could ouf course do it by using If and defining it, but the problem is you would have to update the code instead of just updating the data table : TblOtazky.
任何解决方案?
Br.Ross
推荐答案
将Txt1的控制源设置为问题,将Txt2的控制源设置为A1等。
Set the Control Source of Txt1 to question, of Txt2 to A1, etc.
在表单的On Open事件中,将其RecordSource设置为
In the On Open event of the form, set its RecordSource to
" SELECT * FROM TblOtazky WHERE ID =" &安培; lngID
"SELECT * FROM TblOtazky WHERE ID=" & lngID
其中lngID是您随机生成的唯一ID。
where lngID is the unique ID that you have generated at random.
这篇关于根据定义的确切单元格值(行和列)填充文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!