dbTalk Databases Forums  

access2007 combo box - how to update rowsource

comp.databases.ms-access comp.databases.ms-access


Discuss access2007 combo box - how to update rowsource in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Roger
 
Posts: n/a

Default access2007 combo box - how to update rowsource - 11-22-2011 , 09:39 AM






I've got a continuous form with a bound combo box (suffix)
the rowsource for the cb is "SELECT * FROM
qryQuoteBookingDetailSuffix WHERE quoteId = 34"
which returns one record ('A')

the cb is bound to a field that is used within
qryQuoteBookingDetailSuffix so that my list should only display the
suffixes that haven't yet been choosen

so if I choose that 'A' in the first record of the continous form, I'd
expect the second record on the continuous form to show an empty list
for the cb, but this list still contains the one record ('A')

if I put STOP in the gotFocus() event of the cb, and I run the above
in a query within 'query design' it correctly returns no records

if in the gotFocus() event I do
strsql = suffix.rowsource
set rs = currentdb.openrecordset(strSql)
suffix.rowsource = strsql

rs.eof is true
suffix.Recordset.eof is false
and I still get a list with one record 'A'... why ?

and what can I do with cb's rowsource to show an empty list once 'A'
is selected ?
the best I can do for now, in the form's beforeUpdate event, is try to
detected if 'A' has already been chosen

Reply With Quote
  #2  
Old   
Patrick Finucane
 
Posts: n/a

Default Re: access2007 combo box - how to update rowsource - 11-22-2011 , 01:09 PM






On Nov 22, 9:39*am, Roger <lesperan... (AT) natpro (DOT) com> wrote:
Quote:
I've got a continuous form with a bound combo box (suffix)
the rowsource for the cb is "SELECT * *FROM
qryQuoteBookingDetailSuffix WHERE quoteId = 34"
which returns one record ('A')

the cb is bound to a field that is used within
qryQuoteBookingDetailSuffix so that my list should only display the
suffixes that haven't yet been choosen

so if I choose that 'A' in the first record of the continous form, I'd
expect the second record on the continuous form to show an empty list
for the cb, but this list still contains the one record ('A')

if I put STOP in the gotFocus() event of the cb, and I run the above
in a query within 'query design' it correctly returns no records

if in the gotFocus() event I do
* strsql = suffix.rowsource
* set rs = currentdb.openrecordset(strSql)
* suffix.rowsource = strsql

rs.eof is true
suffix.Recordset.eof is false
and I still get a list with one record 'A'... why ?

and what can I do with cb's rowsource to show an empty list once 'A'
is selected ?
the best I can do for now, in the form's beforeUpdate event, is try to
detected if 'A' has already been chosen
I don't understand your problem. Are you saying that if you select
something from a combo in a continuous form all records for that
column display the same result?

If that is the issue, change the Combo to a text box. On a dbl-click
event create/call a small form that you would pass the id to filter on
and present a combo and OK/Cancel buttons. This form updates the
column field in the continuous form when closed.
..

Reply With Quote
  #3  
Old   
Roger
 
Posts: n/a

Default Re: access2007 combo box - how to update rowsource - 11-22-2011 , 03:20 PM



On Nov 22, 12:09*pm, Patrick Finucane <patrickfinucan... (AT) gmail (DOT) com>
wrote:
Quote:
On Nov 22, 9:39*am, Roger <lesperan... (AT) natpro (DOT) com> wrote:





I've got a continuous form with a bound combo box (suffix)
the rowsource for the cb is "SELECT * *FROM
qryQuoteBookingDetailSuffix WHERE quoteId = 34"
which returns one record ('A')

the cb is bound to a field that is used within
qryQuoteBookingDetailSuffix so that my list should only display the
suffixes that haven't yet been choosen

so if I choose that 'A' in the first record of the continous form, I'd
expect the second record on the continuous form to show an empty list
for the cb, but this list still contains the one record ('A')

if I put STOP in the gotFocus() event of the cb, and I run the above
in a query within 'query design' it correctly returns no records

if in the gotFocus() event I do
* strsql = suffix.rowsource
* set rs = currentdb.openrecordset(strSql)
* suffix.rowsource = strsql

rs.eof is true
suffix.Recordset.eof is false
and I still get a list with one record 'A'... why ?

and what can I do with cb's rowsource to show an empty list once 'A'
is selected ?
the best I can do for now, in the form's beforeUpdate event, is try to
detected if 'A' has already been chosen

I don't understand your problem. *Are you saying that if you select
something from a combo in a continuous form all records for that
column display the same result?

If that is the issue, change the Combo to a text box. *On a dbl-click
event create/call a small form that you would pass the id to filter on
and present a combo and OK/Cancel buttons. *This form updates the
column field in the continuous form when closed.
.- Hide quoted text -

- Show quoted text -
no, after selecting a suffix of 'A' on the first record, everything is
fine
now if I run a query from 'query design' with the statement being used
as the rowsource for the suffix cb it returns nothing, which is
correct because 'A' was selected and is no longer available

but when I dropdown the list of choices for 'suffix' in the second
record, the list still shows 'A' as a valid selection even if I do
suffix.requery within the suffix_gotFocus() event

so I don't understand why the dropdown list isn't empty, and how to
make it so

Reply With Quote
  #4  
Old   
Neil
 
Posts: n/a

Default Re: access2007 combo box - how to update rowsource - 11-22-2011 , 08:20 PM



Quote:
so I don't understand why the dropdown list isn't empty, and how to
make it so

You need to requery the combo box to get it to reset the rowsource. Do this
in the On Current event of each record:

Me.MyCombobox.Requery

Neil

Reply With Quote
  #5  
Old   
Roger
 
Posts: n/a

Default Re: access2007 combo box - how to update rowsource - 11-23-2011 , 05:08 AM



On Nov 22, 7:20*pm, "Neil" <neil.ginsberg+newsgr... (AT) gmail (DOT) com> wrote:
Quote:
so I don't understand why the dropdown list isn't empty, and how to

make it so

You need to requery the combo box to get it to reset the rowsource. Do this
in the On Current event of each record:

Me.MyCombobox.Requery

Neil
but shouldn't that also work if I do cb.requery in the cb_gotFocus()
event, because it doesn't

Reply With Quote
  #6  
Old   
Neil
 
Posts: n/a

Default Re: access2007 combo box - how to update rowsource - 11-23-2011 , 12:01 PM



Quote:
"Roger" <lesperancer (AT) natpro (DOT) com> wrote

On Nov 22, 7:20 pm, "Neil" <neil.ginsberg+newsgr... (AT) gmail (DOT) com> wrote:
Quote:
so I don't understand why the dropdown list isn't empty, and how to

make it so

You need to requery the combo box to get it to reset the rowsource. Do
this
in the On Current event of each record:

Me.MyCombobox.Requery

Neil
but shouldn't that also work if I do cb.requery in the cb_gotFocus()
event, because it doesn't
<<

Are you saying it works in the form_current event, but doesn't work in the
cb_gotFocus event? Or that it doesn't work in either event?

Reply With Quote
  #7  
Old   
Roger
 
Posts: n/a

Default Re: access2007 combo box - how to update rowsource - 11-24-2011 , 06:01 AM



On Nov 23, 11:01*am, "Neil" <neil.ginsberg+newsgr... (AT) gmail (DOT) com> wrote:
Quote:
"Roger" <lesperan... (AT) natpro (DOT) com> wrote in message

news:f1894df9-edba-40f9-9f9e-b0685578036c (AT) y7g2000vbe (DOT) googlegroups.com...
On Nov 22, 7:20 pm, "Neil" <neil.ginsberg+newsgr... (AT) gmail (DOT) com> wrote:

so I don't understand why the dropdown list isn't empty, and how to

make it so

You need to requery the combo box to get it to reset the rowsource. Do
this
in the On Current event of each record:

Me.MyCombobox.Requery

Neil

but shouldn't that also work if I do cb.requery in the cb_gotFocus()
event, because it doesn't


Are you saying it works in the form_current event, but doesn't work in the
cb_gotFocus event? Or that it doesn't work in either event?
correct, it doesn't work from either event

Reply With Quote
  #8  
Old   
Neil
 
Posts: n/a

Default Re: access2007 combo box - how to update rowsource - 11-29-2011 , 03:42 AM



Quote:
"Roger" <lesperancer (AT) natpro (DOT) com> wrote

On Nov 23, 11:01 am, "Neil" <neil.ginsberg+newsgr... (AT) gmail (DOT) com> wrote:
Quote:
"Roger" <lesperan... (AT) natpro (DOT) com> wrote in message

news:f1894df9-edba-40f9-9f9e-b0685578036c (AT) y7g2000vbe (DOT) googlegroups.com...
On Nov 22, 7:20 pm, "Neil" <neil.ginsberg+newsgr... (AT) gmail (DOT) com> wrote:

so I don't understand why the dropdown list isn't empty, and how to

make it so

You need to requery the combo box to get it to reset the rowsource. Do
this
in the On Current event of each record:

Me.MyCombobox.Requery

Neil

but shouldn't that also work if I do cb.requery in the cb_gotFocus()
event, because it doesn't


Are you saying it works in the form_current event, but doesn't work in the
cb_gotFocus event? Or that it doesn't work in either event?
correct, it doesn't work from either event<<

Sorry - I've been away.

If you have me.cb.requery in your form's OnCurrent event (and if you've
confirmed that it's running - press F9 on the line and confirm that the code
stops there when you move to a new record), then I'm not sure what the
problem would be. I assumed it was a requery issue.

In your original post you said the rowsource for the combo box was:

"SELECT * FROM qryQuoteBookingDetailSuffix WHERE quoteId = 34"

which returns record 'A'. You then say:

"the cb is bound to a field that is used within
qryQuoteBookingDetailSuffix so that my list should only display the
suffixes that haven't yet been choosen"

This is the part that's not clear. Why don't you paste the SQL from
qryQuoteBookingDetailSuffix. That would help to see what may or may not be
working here.

Neil

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.