If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Combo Box on Form
I have placed a combo box on a form. When I scroll down with the roller on
my mouse - it works. When I click on the record selector on the bottom of the form - it works. When I click on the drop down box to make my selection - it doesn't work. The selection changes, but the rest of the form stays the same. Suggestions? Thanx! |
#2
|
|||
|
|||
Combo Box on Form
Hi Anne,
put code in the after update event of the combo box like this cboSubcategory is the name of the combo SubcategoryID is the name of the field in the 1st (hidden) field of the combo Private Sub cboSubcategory_AfterUpdate() ' Find the record that matches the control. Dim rs As Object Set rs = Me.Recordset.Clone rs.FindFirst "[SubcategoryID] = " & (Nz(Me![cboSubcategory], 0) If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark End if End Sub Jeanette Cunningham "MDI Anne" wrote in message ... I have placed a combo box on a form. When I scroll down with the roller on my mouse - it works. When I click on the record selector on the bottom of the form - it works. When I click on the drop down box to make my selection - it doesn't work. The selection changes, but the rest of the form stays the same. Suggestions? Thanx! |
#3
|
|||
|
|||
Combo Box on Form
I think you have spazed your data.
If the combo box is a bound control, each time you make a selection, you are changing the value in underlying table. Combo's used for searching should be unbound and only used for searching. Then to make the selected record the current record, you use the After Update event of the combo box: If Not IsNull(Me.MyCombo) Then With Me.RecordsetClone .FindFirst "[MyField] = " & Me.MyCombo If Not .NoMatch Then Me.Bookmark = .Bookmark End If End With End If -- Dave Hargis, Microsoft Access MVP "MDI Anne" wrote: I have placed a combo box on a form. When I scroll down with the roller on my mouse - it works. When I click on the record selector on the bottom of the form - it works. When I click on the drop down box to make my selection - it doesn't work. The selection changes, but the rest of the form stays the same. Suggestions? Thanx! |
#4
|
|||
|
|||
Combo Box on Form
Jeanette,
FYI, you should always close recordsets before exiting the procedure and set the reference to Nothing rs.Close Set rs = Nothing Most of the time, it will not be a problem, but it is good housekeeping. And, read my response. Note I use the recordsetclone which means I don't have to take the time and resource to create a recordset and close it. -- Dave Hargis, Microsoft Access MVP "Jeanette Cunningham" wrote: Hi Anne, put code in the after update event of the combo box like this cboSubcategory is the name of the combo SubcategoryID is the name of the field in the 1st (hidden) field of the combo Private Sub cboSubcategory_AfterUpdate() ' Find the record that matches the control. Dim rs As Object Set rs = Me.Recordset.Clone rs.FindFirst "[SubcategoryID] = " & (Nz(Me![cboSubcategory], 0) If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark End if End Sub Jeanette Cunningham "MDI Anne" wrote in message ... I have placed a combo box on a form. When I scroll down with the roller on my mouse - it works. When I click on the record selector on the bottom of the form - it works. When I click on the drop down box to make my selection - it doesn't work. The selection changes, but the rest of the form stays the same. Suggestions? Thanx! |
Thread Tools | |
Display Modes | |
|
|