natalie,
I looked at the code I posted and somehow it got mangled. Here it is again:
Private Sub Combo117_AfterUpdate()
'Find the record that matches the control.
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "[Meeting Code] = '" & Me![Combo117] & "'"
If rs.NoMatch Then
MsgBox "No record found for [Meeting Code] = '" & Me![Combo117] & "'"
Else
'record found
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End Sub
I wanted to see the row source for the combo box to make sure the bound column
was text. So I created a query for the combo box and a form. I tried the after
update code I provided (the corrected code above) and I tried your code, using
Set rs = Me.Recordset.Clone
and
Set rs = Me.RecordsetClone
All versions of the code (yours and mine) select the correct record. Note that
if there are multiple records with the same "Meeting Code", only the "first"
record that matches will be found.
Combo117 is unbound and I tried with Combo117 in the form header and the form
default view set to continuous forms.
Then I tried Combo117 in the detail section and the default view set to single
form.
In all cases I encountered no problems.
I cannot duplicate the error you are getting.
Have you tried doing a "Compact and Repair"?
Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)
SELECT [qry Combo Box Meeting Code].[Meeting Code] FROM [qry Combo Box
Meeting Code];
Does that help?
:
??? there is no SQL in the afterupdate code. It is VB.
Please post the SQL for the rowsource of the combo box.
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)
:
Hi, Steve
I tried the code below but sql didn't like it. What I don't understand is
that this is the exact same code I have in 2 other separate databases for
unbound combo boxes being used the exact same way. No control source, row
source based on a query, same event procedure for after update and before
update - nothing is different except that this combo box doesn't want to
work. I'm really at a loss.
I can get it to change populated fields by either choosing from the drop
down or using the next/previous arrows - but not both. I simply can't
remember how I did it the last 2 times.
:
Two thoughts:
1) Try this code
Private Sub Combo117_AfterUpdate()
'Find the record that matches the control.
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "[Meeting Code] = '" & Me![Combo117] & "'"
If Not rs.NoMatch
Then Me.Bookmark = rs.Bookmark
Else
Msgbox ("No record found for [Meeting Code] = '" & Me![Combo117] & "'"
Set rs = Nothing
End Sub
2) If you are using A2K or higher, do you have a reference set for
Microsoft DAO 3.6 Object Library ?
And it is 'above' the reference to Activex Data Objects?
HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)
:
Ooops! forgot to paste the after update code in my last post!
Private Sub Combo117_AfterUpdate()
'Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Meeting Code] = '" & Me![Combo117] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub