473,503 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem Setting Combobox Choices from Stored Query

I have a form with several comboboxes whose contents I'm trying to
initialize from a table. The table, ComboSelections, has 3 fields,
an autonumber ID and two text fields, ListCode and ListEntry. ListCode
contains the actual names of the comboboxes, each of which has several
ListEntry values. Here for example is the part of the table that
'defines' the cboQuality_rating combobox:

Id ListCode ListEntry
1 cboQuality_rating Excellent
4 cboQuality_rating Adequate
5 cboQuality_rating Fair
6 cboQuality_rating Limited
7 cboQuality_rating Poor

I've created a single stored query for the row source of each of these
comboboxes:
---------------------------
SELECT ComboSelections.ListEntry
FROM ComboSelections
WHERE (((ComboSelections.ListCode)=[forms]![datasystem]![thisList]));

thisList is a global variable in form datasystem [I note now that in the
way I was hoping to do this, a local variable in the onload sub of the
function should be sufficient].

If I try to use Me!thisList in the WHERE clause above, it gets
interpreted as a parameter: this, too I don't understand.

Then I try to use this scheme: I will fill the comboboxes when loading
the form:

Private Sub Form_Load()
thisList = cboQuality_rating.Name
cboQuality_rating.Requery
Debug.Print "LOADING FORM: thisList = *" & thisList & "*"

End Sub

In the immediate window I do get LOADING FORM: thisList = *cboQuality_rating*
But nothing gets loaded into the combobox. What am I doing wrong?

thanks, --thelma
Dec 13 '07 #1
1 1621
Thelma Roslyn Lubkin wrote:
I have a form with several comboboxes whose contents I'm trying to
initialize from a table. The table, ComboSelections, has 3 fields,
an autonumber ID and two text fields, ListCode and ListEntry. ListCode
contains the actual names of the comboboxes, each of which has several
ListEntry values. Here for example is the part of the table that
'defines' the cboQuality_rating combobox:

Id ListCode ListEntry
1 cboQuality_rating Excellent
4 cboQuality_rating Adequate
5 cboQuality_rating Fair
6 cboQuality_rating Limited
7 cboQuality_rating Poor

I've created a single stored query for the row source of each of these
comboboxes:
---------------------------
SELECT ComboSelections.ListEntry
FROM ComboSelections
WHERE (((ComboSelections.ListCode)=[forms]![datasystem]![thisList]));

thisList is a global variable in form datasystem [I note now that in the
way I was hoping to do this, a local variable in the onload sub of the
function should be sufficient].

If I try to use Me!thisList in the WHERE clause above, it gets
interpreted as a parameter: this, too I don't understand.

Then I try to use this scheme: I will fill the comboboxes when loading
the form:

Private Sub Form_Load()
thisList = cboQuality_rating.Name
cboQuality_rating.Requery
Debug.Print "LOADING FORM: thisList = *" & thisList & "*"

End Sub

In the immediate window I do get LOADING FORM: thisList = *cboQuality_rating*
But nothing gets loaded into the combobox. What am I doing wrong?

thanks, --thelma
There is a difference between a variable and a text box. You assign a
global variable a value. But you have a query referencing (most likely
a textbox) an object [forms]![datasystem]![thisList].

It won't work. I would consider creating a text box, setting the
visible property to False/No, and assign your value to the textbox.

That Girl
http://www.youtube.com/watch?v=tBe4W-j6UO8
Dec 13 '07 #2

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

Similar topics

3
2507
by: Sarah Smith via AccessMonster.com | last post by:
I am creating a database of documents that need to be worked on, are int eh proress of being worked on, and have been completed. Sometimes the same document (an updated version) comes back for more...
8
3073
by: Geir Baardsen | last post by:
Hi! I have several textfiles on disk like: Thing 1 Thing 2 etc... On a form I have two combo-boxes. When user chooses from Combo1
4
1580
by: simonmarkjones | last post by:
Hi all, I have 2 ComboBoxes The first has 3 choices Planning Building Control Planning & Building Control
0
2140
by: Jax | last post by:
I am using a class that inherits from the DataGridTextBoxColumn. It adds a combo box into the column where it displays a selection of choices. The problem I have is that when this comboBox loses...
6
1712
by: billmiami2 | last post by:
I'm experiencing a strange problem that I believe is related to ADO.NET but I can't say for sure. I have a simple ASP.NET reporting interface to a SQL Server 2000 database. One report that we...
9
9666
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
5
1444
by: =?Utf-8?B?c3Rob21hc29AcGhtaW5pbmcuY29t?= | last post by:
Hello. I'm having trouble getting a combobox bound to a property of an object. I am populating the combobox using data binding, but I can't get the SelectedValue property to bind to an object; it...
2
1812
by: gleadams | last post by:
I have databound a Windows form ComboBox control to a DataSource and DataMember and it is properly showing the data as I navigate through the records. My question concerns the choices in the...
12
5063
by: ezechiel | last post by:
hi, the combobox is filled correctly and when I choose an item, the selected item is put into the DB by _AfterUpdate code. Row source: SELECT SOP.SOP_id, SOP.SOP_name, SOP.SOP_nr FROM SOP ...
0
7203
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
7087
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
7334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5579
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,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
737
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.