I have an unbound combo box (cboEffDate). The recordsource for this box is a simple query that shows the effective dates stored in tblCapacity.Eff Date. What I want to happen is for the user to select an Effective Date from the drop down, then have my text boxes on the form populate with the field values associated with the effective date. Once those fields are populated with the correct set of variables, there are some calculations.
The error is in the "where" clause.
Also, the field [EffDate] is a short date type in the table. The cboEffDate is also formated for short date.
Expand|Select|Wrap|Line Numbers
- Private Sub cboEffDate_AfterUpdate()
- ' Pull info out of SQL View.
- Dim db As Database
- Dim rs As Recordset
- Set db = CurrentDb
- Set rs = db.OpenRecordset("SELECT * " & _
- "FROM tblCapacity " & _
- "WHERE [EffDate] = " & Me.cboEffDate.Value & "")
- Me.txtFieldCap = rs![Field Inlet Capacity]
- Me.txtT1Start = rs![T1 Start Date]
- Me.txtT1End = rs![T1 End Date]
- Me.txtT1Inlet = rs![T1 Inlet Gas]
- Me.txtT1Residue = rs![T1 Residue Design]
- Me.txtT1Fuel = rs![T1 Fuel]
- End Sub