0

I realize the newbieness of this question, but google searches are not helping me.

I've created an MS Access database and am trying to automatically update a cell in a row when another cell is updated with data from a drop-down menu. I've created a sub "afterupdate" for the text box in the form, and can simply create a "select case" to update the cell based on what value is entered.

However, the Select Case would be very long, and I already have the list of values populated in another table in the database. Is there a way to set the value of the new cell to whatever the corresponding value is?

Example:

Table 1:

Mode --- Time

A --------- 1:00

B --------- 2:00

C --------- 4:00

So, in my form, when I select "A" for one cell, another cell would automatically update with the information "1:00". Again, "Select Case" works, I am wondering if there is a faster way.

4

1 に答える 1

0

フォームでこれを行いたい場合は、試してみましょう

  • cmbModeというコンボ ボックスを含むフォームを作成します 。
  • Properties/Dataで、Row SourceSELECT * FROM tblModesに変更 します。
  • プロパティ/フォーマットで、列数を 2 に変更 します。
  • プロパティ/フォーマットで、列幅を 3,0 に変更 します。
  • txtTimeというテキスト ボックスを作成します。
  • プロパティ/データで、コントロール ソースを =[cmbMode].[Column] (1) に変更 します。

変更時に自動更新する必要があります。

編集

テキスト ボックスはフィールドにバインドされないため、これは値をテーブルに更新しません。

コンボ ボックスの AFTER_UPDATE イベントを使用するように変更できます (テキスト ボックスがTIMEフィールドにバインドされている場合)。

Time.Value = cmbMode.Column(1)
于 2010-01-20T16:59:37.960 に答える