Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ItemData (combo box value not writing to table)

Status
Not open for further replies.

tbassngal

Programmer
Feb 18, 2003
74
0
0
US
Hi all, I have the following sub procedure. The combo box is being filtered as I want it filtered and the control source is Desc1 but cboDesc1.value does not write to the table... cboApplication.value does. Any ideas? Please help.

Private Sub cboApplication_AfterUpdate()
Dim sSQL As String

'Desc1 Value
'clear cboDesc1
Me.cboDesc1 = Null

sSQL = "SELECT Desc1 FROM tblApplicationDescription"
sSQL = sSQL & " WHERE [Application] = '" & Me.[cboApplication] & "' "
sSQL = sSQL & " ORDER BY Desc1"

'Debug.Print sSQL1

Me.cboDesc1.RowSource = sSQL

'check if cboDesc1 has values
If IsNull(Me.cboDesc1.ItemData(0)) Then
Me.cboDesc1.Enabled = False
Else
Me.cboDesc1.Enabled = True
Me.cboDesc1 = Me.cboDesc1.ItemData(0)

'optional
Me.cboDesc1.SetFocus
Me.cboDesc1.Dropdown
End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top