【发布时间】:2016-12-06 10:17:50
【问题描述】:
我无法弄清楚我的代码哪里出错了。当用户在组合框中选择一个值时,我希望它转到顾问表并获取该顾问的默认费率并将其粘贴在每小时费率文本框中。 This is the msg that I get when I update the combobox.
Private Sub cmbConsultant_Change()
Dim db As Database
Dim rs As DAO.Recordset ''Requires reference to Microsoft DAO x.x Library
Dim strSQL As String
strSQL = "defaultFee * FROM tblConsultants WHERE ID = """ & Me!cmbConsultant & """"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
If rs.RecordCount > 0 Then
Me.txtHourlyRate = rs!CountOfEndDeviceType
Else
Me.txtHourlyRate = ""
End If
Set rs = Nothing
Set db = Nothing
结束子
【问题讨论】:
标签: ms-access combobox vba ms-access-2010