467,927 Members | 1,827 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,927 developers. It's quick & easy.

combo box failure

i have a table with a yes/no field call "Edited". i have a button that
runs code to set the "Edited" field of a selected record to "yes". the
code also set the rowsource (using SQL Update and Set statement) of a
combo box to display only records with the "Edited" field = "No". the
button and the combo box are on the same form. the record is selected
from the combo box.

when i step through the code in debug mode, the combo box nicely
displays correctly only records with the "Edited" field = "No". which
could mean nothing wrong with the code? but when i click the button in
open form mode and open the combo box, the combo box displays both the
record with the "Edited" field = Yes and records with "Edited" field =
No. for the record where the "Edited" field has been set to "Yes", the
"edited" field displayed in the combo box shows a "No". the "Edited"
field change to a "Yes" only after i open the combo box twice. the
record with the "Edited" field = "Yes" disappears from the combo box
only after i have set another record's "Edited" field to "yes". this
does not happen all the time though.

what have i done wrong? what is the right way to do it so that the
combo box correctly display only records where "Edited" field ="No" at
all times?

thanks for your help.

Apr 8 '08 #1
  • viewed: 1408
Share:
2 Replies
fr*****@gmail.com wrote:
i have a table with a yes/no field call "Edited". i have a button that
runs code to set the "Edited" field of a selected record to "yes". the
code also set the rowsource (using SQL Update and Set statement) of a
combo box to display only records with the "Edited" field = "No". the
button and the combo box are on the same form. the record is selected
from the combo box.

when i step through the code in debug mode, the combo box nicely
displays correctly only records with the "Edited" field = "No". which
could mean nothing wrong with the code? but when i click the button in
open form mode and open the combo box, the combo box displays both the
record with the "Edited" field = Yes and records with "Edited" field =
No. for the record where the "Edited" field has been set to "Yes", the
"edited" field displayed in the combo box shows a "No". the "Edited"
field change to a "Yes" only after i open the combo box twice. the
record with the "Edited" field = "Yes" disappears from the combo box
only after i have set another record's "Edited" field to "yes". this
does not happen all the time though.

what have i done wrong? what is the right way to do it so that the
combo box correctly display only records where "Edited" field ="No" at
all times?

thanks for your help.
I don't know what the combo has to do with displaying records with the
value set to No or Yes.

If you want to see records with Edited set to no you can have the
recordsource do it for you
Select * from Table1 where edited = False
or set the filter programatically.
Me.Filter = "Edited = False"
Me.FilterOn = True

I could have a combo with 3 options; Not Edited, Edited, ShowAll.
In the combo's AfterUpdate event I could do this
Dim strF As String
Select Case Me.ComboBoxName
Case "Not Edited"
strF = "Edited = False"
Case "Edited"
strF = "Edited = True
End Select
Me.Filter = strF
Me.FilterOn = (strF "") 'ShowAll would be ""

BeYourself
http://www.youtube.com/watch?v=xzNYfMTWpVs


Apr 8 '08 #2
The very strong possiblity is that the code does not wait for the update of
the "Edited" Field in the Table to be completed, before resetting the
RowSource of the Combo (and Requerying the Combo?). In debug mode, stepping
through at the speed of the human interface (you), you delay the resetting
of the Combo enough that the update has already completed.

I am a little puzzled at your comment about "(using SQL Update and Set
statement)" in regards to setting the RowSource... my usual Row Source is
either a text Value List, or the text of an SQL Statement, or the text name
of a saved Query... so I'm not sure what you are trying to do.

If you'll post the code... (I think the astrological configuration is not at
its best just now, because our psychic powers to "divine" what code you have
are at a low ebb)... perhaps someone can offer you a suggestion on what to
do.

Larry Linson
Microsoft Access MVP

<fr*****@gmail.comwrote in message
news:98**********************************@q10g2000 prf.googlegroups.com...
>i have a table with a yes/no field call "Edited". i have a button that
runs code to set the "Edited" field of a selected record to "yes". the
code also set the rowsource (using SQL Update and Set statement) of a
combo box to display only records with the "Edited" field = "No". the
button and the combo box are on the same form. the record is selected
from the combo box.

when i step through the code in debug mode, the combo box nicely
displays correctly only records with the "Edited" field = "No". which
could mean nothing wrong with the code? but when i click the button in
open form mode and open the combo box, the combo box displays both the
record with the "Edited" field = Yes and records with "Edited" field =
No. for the record where the "Edited" field has been set to "Yes", the
"edited" field displayed in the combo box shows a "No". the "Edited"
field change to a "Yes" only after i open the combo box twice. the
record with the "Edited" field = "Yes" disappears from the combo box
only after i have set another record's "Edited" field to "yes". this
does not happen all the time though.

what have i done wrong? what is the right way to do it so that the
combo box correctly display only records where "Edited" field ="No" at
all times?

thanks for your help.

Apr 8 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by vgrssrtrs | last post: by
4 posts views Thread by Heather | last post: by
reply views Thread by zlib101892NoSpam | last post: by
2 posts views Thread by kiranmn75 | last post: by
2 posts views Thread by =?Utf-8?B?ZnJlZGR5?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.