我有一个数字组合框。
我选择第一个并按下按钮,然后将在连续形式中添加两个特定的记录。
现在我想让这个更先进,这样,如果我按下按钮将在连续形式中添加另外两个记录。而是根据下一条记录放入组合框。
Private Sub Doublestart_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = Recordset
rs.AddNew
Me.Trail = Me.Traildoulestart
Me.RallyKlasID = 101
RallyKlasnaam.value = RallyKlasID.Column(1)
RallyKlasgroep.value = RallyKlasID.Column(2)
Me.Handler.value = Forms!FormClassEnteryRally.Form.ExhibitorRally
rs.AddNew
Me.Trail = Me.Traildoulestart
Me.RallyKlasID = 104
RallyKlasnaam.value = RallyKlasID.Column(1)
RallyKlasgroep.value = RallyKlasID.Column(2)
Me.Handler.value = Forms!FormClassEnteryRally.Form.ExhibitorRally
End Sub
Private Sub MoveDown_Click()
ComboName.SetFocus
If ComboName.ListIndex <> ComboName.ListCount - 1 Then
ComboName.ListIndex = ComboName.ListIndex + 1
Else
ComboName.ListIndex = 0
End If
End Sub
this works:)
尝试在下拉列表
中找到要记录的代码用当前项返回的combobox自己的ListIndex来增加combobox的ItemData索引,以移动到下一项并填充combobox Value。
With Me.comboboxName
If .ListIndex <> .ListCount - 1 Then .Value = .ItemData(.ListIndex + 1)
End With