473,396 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Requery Combo box Recordset

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.

Nov 13 '05 #1
5 4073
On 6 Jan 2005 23:09:43 -0800, "Giloosh" <gi*******@hotmail.com> wrote:
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
Nov 13 '05 #2
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.

Nov 13 '05 #3
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

Nov 13 '05 #4
On 6 Jan 2005 23:38:19 -0800, "Giloosh" <gi*******@hotmail.com> wrote:
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
Nov 13 '05 #5
Thanks again mike!

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Scott | last post by:
I have created a form that has a few combo boxes on it. On the form I have ComboBoxA which selects data from a region, and ComboBoxB that selects individual locations within a selected region. I...
3
by: Yves | last post by:
Hi, I'm requering a combobox, and attempting to a) force it to have the first item selected instead of no item selected b) use values in hidden columns of the combobox for the selected item ...
0
by: Michelle | last post by:
Hi all I have a main form which has a combo box and a subform. The two forms are linked by ShiftPatternName which is basically the value in the combo. the combo has the following code ...
20
by: MS | last post by:
Access 97 I want to requery the data being displayed on a form, then I want to return to the record I was in. Why doesn't this code work? Private Sub CmdRefsh_Click()
1
by: Bill | last post by:
Problem: Combo box data disappears from view when a requery is done See "Background" below for details on tables, forms & controls On a form, I want to use the setting of bound combo box C1...
11
blyxx86
by: blyxx86 | last post by:
I can't seem to get this figured out. I am trying to requery another form after adding new information to a table that a cboList is created from. So, I have a combo box that has Sales personnel,...
7
by: raneking22 | last post by:
I have a form with 2 combo boxes in it. The first combo box is named combo0 and has as its row source: SELECT DISTINCT !field1 FROM ORDER BY ; The second combo box has as its row source: ...
12
waynetheengineer
by: waynetheengineer | last post by:
Hi, I have a combo box on a form with a list of cities in it based on a single field city table. I also have a command button on this form that opens up another form that allows the user to enter...
11
by: The Frog | last post by:
Hi all, Maybe I am just missing something simple here, but I seem to have an issue with a callback function in A97 that is used to fill a Listbox with values. The first time the callback...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.