combo box after update error pt 2

G

Guest

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
 
G

Guest

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
 
G

Guest

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.

SteveS said:
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.)


natalie said:
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
 
G

Guest

??? 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.)


natalie said:
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.

SteveS said:
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.)


natalie said:
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
 
G

Guest

SELECT [qry Combo Box Meeting Code].[Meeting Code] FROM [qry Combo Box
Meeting Code];

Does that help?

SteveS said:
??? 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.)


natalie said:
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.

SteveS said:
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
 
S

SteveS

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
 
G

Guest

Hi Steve,
Thanks for all your help - I'm almost there, just one glitch. The combo box
works beautifully as far as bringing up the related data and populating the
fields based on choosing from the box or using the next/previous arrow.
However, for some bizaare reason, the combo data, in this case the meeting
code, is not actually displayed in the box. Really weird, I know. I believe
I have isolated the problem to the vb code:
Private Sub Form_Current()
Combo22 = MeetingCode
End Sub
However, when I remove this code the darn thing stops working altogether.
Any ideas?

SteveS said:
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
 
G

Guest

Bear in mind that I can't see your mdb, what is Combo22? Wnat is
"MeetingCode"? Is it the name of s control? In the previous code, "[Meeting
Code]" (with a space) is the name of a field. Should is be "MeetingCode" or
"Meeting Code" ?

Check the column width setting for the combo box "Combo22". How many fields
are in the row source.... Is the column count correct?

You can add a message line to the code to ensure that "MeetingCode" is not
Null/Empty:

Private Sub Form_Current()

'next line is for debugging
Msgbox "Meeting code value = " & meetingCode

Combo22 = MeetingCode
End Sub


HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


natalie said:
Hi Steve,
Thanks for all your help - I'm almost there, just one glitch. The combo box
works beautifully as far as bringing up the related data and populating the
fields based on choosing from the box or using the next/previous arrow.
However, for some bizaare reason, the combo data, in this case the meeting
code, is not actually displayed in the box. Really weird, I know. I believe
I have isolated the problem to the vb code:
Private Sub Form_Current()
Combo22 = MeetingCode
End Sub
However, when I remove this code the darn thing stops working altogether.
Any ideas?

SteveS said:
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
 

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