dbTalk Databases Forums  

Requery Combo box Recordset

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


Discuss Requery Combo box Recordset in the comp.databases.ms-access forum.



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

Default Requery Combo box Recordset - 01-07-2005 , 01:09 AM






Hello,
I have a combobox with a rowsource of two fields. [name] and [id]
even though the combobox only shows the name, when i pull down the name
i grab the id that it belongs to like this:
'AFTERUPDATE:
ID = me.combobox.recordset.fields.item["id"]

now if i REQUERY this combobox either by selecting it and clicking 'f9'
or by running the code me.combobox.requery, i some how loose the
recordset.

the next time i choose a name and trigger the "AFTERUPDATE" event i get
the following error:
"the value you entered isn't valid for this field."

Is there any method of preventing this error after REQUERYING a
combobox with a recordset.

Any help would be highly appreciated.


Reply With Quote
  #2  
Old   
Mike Preston
 
Posts: n/a

Default Re: Requery Combo box Recordset - 01-07-2005 , 01:22 AM






On 6 Jan 2005 23:09:43 -0800, "Giloosh" <giloosh99 (AT) hotmail (DOT) com> wrote:

Quote:
Hello,
I have a combobox with a rowsource of two fields. [name] and [id]
even though the combobox only shows the name, when i pull down the name
i grab the id that it belongs to like this:
'AFTERUPDATE:
ID = me.combobox.recordset.fields.item["id"]

now if i REQUERY this combobox either by selecting it and clicking 'f9'
or by running the code me.combobox.requery, i some how loose the
recordset.

the next time i choose a name and trigger the "AFTERUPDATE" event i get
the following error:
"the value you entered isn't valid for this field."

Is there any method of preventing this error after REQUERYING a
combobox with a recordset.
Why not use:

id = me.combobox.column(1)

BTW, I'm not fond of using things like "id" and "name". You might
want to use a naming convention that ensures your selections are
reserved words that have other inherent meanings (such as "name").

mike


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

Default Re: Requery Combo box Recordset - 01-07-2005 , 01:28 AM



WOW! thanks alot, that was so much more easier.
I agree with you on the naming conventions, i just used those names for
this example.


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

Default Re: Requery Combo box Recordset - 01-07-2005 , 01:38 AM



The column method is good, but how can i use it without having to show
all of the columns, having like 5 columns be record.
thanks


Reply With Quote
  #5  
Old   
Mike Preston
 
Posts: n/a

Default Re: Requery Combo box Recordset - 01-07-2005 , 01:42 AM



On 6 Jan 2005 23:38:19 -0800, "Giloosh" <giloosh99 (AT) hotmail (DOT) com> wrote:

Quote:
The column method is good, but how can i use it without having to show
all of the columns, having like 5 columns be record.
thanks
In the properties of the Combo Box, there is a tab entitled "Format".
On that tab, you will find a row entitled "Column Widths". Put 1
entry in for each column that you have defined. Make the entry:

0"

for any column you wish to "hide".

It will still be there for your use in programming, though.

mike


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.