Combo Box Selection Disappears

G

Guest

I have a combo box on a form that provides a list of names. If I select from
the drop down list, the code functions as it should, but when I type in part
of the name and exit the combo box the entry disappears and the code is not
executed. When I debug the OnExit code, the value for drop down list is
still Null. On other forms, the type ahead process works and the value for
the drop down list is captured and the value remains.
 
G

Guest

I have a combo box on a form that provides a list of names. If I select from
the drop down list, the code functions as it should, but when I type in part
of the name and exit the combo box the entry disappears and the code is not
executed. When I debug the OnExit code, the value for drop down list is
still Null. On other forms, the type ahead process works and the value for
the drop down list is captured and the value remains.

What code is it that does not execute? You could maybe try moving the code
to be called on after update. Please give some more information on the
problem if this does not help

Falty
 
G

Guest

Falty said:
What code is it that does not execute? You could maybe try moving the code
to be called on after update. Please give some more information on the
problem if this does not help

Falty

Basically, once the user makes a selection from the drop down list, a number
of controls are activated on the Form. Here's the code:

Private Sub combo_resource_Exit(Cancel As Integer)

Dim strSql As String, rst As Recordset
Dim msg, title, Response As String
Dim name As String
Dim dt_today As Date

dt_today = Format(Date, "mm/dd/yyyy")

Me.cal_start_date.Value = dt_today
Me.cal_end_date.Value = dt_today
Me.cal_holiday.Value = dt_today

If ((IsNull(Me.combo_resource.Value) = True) Or (Me.combo_resource.Value =
"")) Then
Exit Sub
End If

strSql = "SELECT * FROM tbl_employees WHERE employee_id = " &
Me.combo_resource.Value
Set rst = CurrentDb.OpenRecordset(strSql)
If rst.EOF = True Then
msg = "Employee no longer in database"
title = "Employee Error"
Response = MsgBox(msg, vbOKOnly, title)
rst.Close
Exit Sub
End If

rst.MoveFirst

name = rst![first_name] & " " & rst![last_name]

Me.lbl_resource_name.Caption = name

Me.lbl_end_date.Visible = True
Me.lbl_start_date.Visible = True
Me.cal_end_date.Visible = True
Me.cal_start_date.Visible = True
Me.lbl_note.Visible = True
Me.button_edit.Visible = True
With Me.opt_full_day
.Visible = True
.Value = 1
End With
Me.lbl_yes.Visible = True

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top