473,385 Members | 1,730 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,385 software developers and data experts.

Need help on fetching column values and populating a combobox.

ssb
Hello,

This may be very elementary, but, need help because I am new to access
programming.

(1) Say, I have a column EMPLOYEE_NAME. How do I fetch (maybe, cursor
?) the values one by one and populate a combo box with these names.
(this way, I can display all the EMPLOYEE_NAME values)

(2) In general, can I do additional processing on column values from
within a cursor?

Eg: (a) populate a combo box,
(b) convert column value into a text-label value or a text box
value,
(c) store the column value into a local variable and use it in
future etc..

(3) Can I do a reverse process. i.e. Read a combox box sequentially
and taking that element as KEY, do and INSERT / UPDATE / DELETE on
EMPLOYEE_TABLE..??

Can you suggest some resources, where sample codes are given for these
kind of manipulations..?

Thanks for the help...
Nov 13 '05 #1
3 3128
ssb wrote:
Hello,

This may be very elementary, but, need help because I am new to access
programming.

(1) Say, I have a column EMPLOYEE_NAME. How do I fetch (maybe, cursor
?) the values one by one and populate a combo box with these names.
(this way, I can display all the EMPLOYEE_NAME values)

(2) In general, can I do additional processing on column values from
within a cursor?

Eg: (a) populate a combo box,
(b) convert column value into a text-label value or a text box
value,
(c) store the column value into a local variable and use it in
future etc..

(3) Can I do a reverse process. i.e. Read a combox box sequentially
and taking that element as KEY, do and INSERT / UPDATE / DELETE on
EMPLOYEE_TABLE..??

Can you suggest some resources, where sample codes are given for these
kind of manipulations..?

Thanks for the help...

You can do most of that.

Look up the RowSouce property in Help for info on how to populate a
combo box from a table.

You can use the AfterUpdate event of the combo box to take the selected
value and put it in a text box or local variable, or make changes to the
source table.

The Access Developer Handbook series by Litwin, Getz et al (Sybex) are
excellent resources.
Nov 13 '05 #2
"ssb" wrote
(1) Say, I have a column EMPLOYEE_NAME.
How do I fetch (maybe, cursor?) the values
one by one and populate a combo box with
these names. (this way, I can display all the
EMPLOYEE_NAME values)
We generally do not use the "cursor" term in Access unless referring to a
server database, and there is a very simple way to populate the Combo Box
with the data you describe. Create a Query, using the Query Builder, that
has the columns you want, and use the Wizard to create the Combo Box. If, as
is often convenient, you have a unique EmployeeID field in that table, it
may well be the field that you wish to store.
(2) In general, can I do additional processing
on column values from within a cursor?
In a Query, you can define calculated fields using Access expressions and
user-defined Functions... that is very flexible. If you choose to use DAO --
Data Access Objects code in Visual Basic for Applications (or ADO, though I
recommend DAO, generally), you can add processing for each or particular
records.
Eg: (a) populate a combo box,
See above
(b) convert column value into a text-label
value or a text box value,
Labels have a Caption (no Value property) that can be set from VBA code, but
not from a Query -- they are not intended to be used to display data from
your tables. Text Boxes have a Control Source property that can be used to
bind them to a Field in the Form's RecordSource (a Query, SQL Statement, or
Table), or that can be used to contain an expression for a calculated
Control.
(c) store the column value into a local
variable and use it in future etc..
You can do this from VBA code, either in a Form or Report event, or code
executed that reads in a RecordSet and processes it.
(3) Can I do a reverse process. i.e. Read a
combox box sequentially and taking that
element as KEY, do and INSERT /
UPDATE / DELETE on EMPLOYEE_TABLE..??
Yes, but the intention of a Combo Box is not for "data input", and certainly
not for its list to be accessed sequentially. It is to allow the user to
select a list entry.
Can you suggest some resources, where sample
codes are given for these kind of manipulations..?


From the questions you ask, it would appear to me that you need some basic,
novice Access user training/education, although you seem familiar with some
(server) database terminology (such as 'cursor').

I'd suggest you start by investing in a simple self study book such as
"Microsoft Access Step-by-Step" from Microsoft Press -- it is a very good
book for beginning Access users (but see below). Another Microsoft Press
Book that starts at the beginning and goes deeper is "Microsoft Access 2003
Inside Out" by John Viescas - I strongly recommend this one. A third-party
book that I have used in past editions is Roger Jenning's "Special Edition
Using Access <version>". There are a couple of other series that I suggest,
later in your study, Dr. Rick Dobson's "Programming Microsoft Access
<version>" is good for moving from power-user to developer with an emphasis
on VBA (though I tend to think he underemphasizes DAO and overemphasizes
ADO), and a second series that is a concensus choice of serious Access
developers, the Access Developer's Handbook, by Litwin, Getz, et al, from
Sybex -- but you are some study away from being ready for either of these.

If you are using Access 2002 or 2003, the training courses that you can
reach via
http://office.microsoft.com/training...EC790020111033
are free and may get you started so that you can bypass the "Step by Step"
book.

Welcome to the world of Access and good luck with your studies. One piece of
advice: don't expect Access to be something else with which you are
familiar, either scaled down or up -- cherish it for itself, because it is a
really good product that extends far beyond the "little desktop database"
that some have thought it to be.

Larry Linson
Microsoft Access MVP
Nov 13 '05 #3
Larry Linson wrote:
"ssb" wrote
> (1) Say, I have a column EMPLOYEE_NAME.
> How do I fetch (maybe, cursor?) the values
> one by one and populate a combo box with
> these names. (this way, I can display all the
> EMPLOYEE_NAME values)


We generally do not use the "cursor" term in Access unless referring to a
server database, and there is a very simple way to populate the Combo Box
with the data you describe. Create a Query, using the Query Builder, that
has the columns you want, and use the Wizard to create the Combo Box. If, as
is often convenient, you have a unique EmployeeID field in that table, it
may well be the field that you wish to store.
> (2) In general, can I do additional processing
> on column values from within a cursor?


In a Query, you can define calculated fields using Access expressions and
user-defined Functions... that is very flexible. If you choose to use DAO --
Data Access Objects code in Visual Basic for Applications (or ADO, though I
recommend DAO, generally), you can add processing for each or particular
records.
> Eg: (a) populate a combo box,


See above
> (b) convert column value into a text-label
> value or a text box value,


Labels have a Caption (no Value property) that can be set from VBA code, but
not from a Query -- they are not intended to be used to display data from
your tables. Text Boxes have a Control Source property that can be used to
bind them to a Field in the Form's RecordSource (a Query, SQL Statement, or
Table), or that can be used to contain an expression for a calculated
Control.
> (c) store the column value into a local
> variable and use it in future etc..


You can do this from VBA code, either in a Form or Report event, or code
executed that reads in a RecordSet and processes it.
> (3) Can I do a reverse process. i.e. Read a
> combox box sequentially and taking that
> element as KEY, do and INSERT /
> UPDATE / DELETE on EMPLOYEE_TABLE..??


Yes, but the intention of a Combo Box is not for "data input", and certainly
not for its list to be accessed sequentially. It is to allow the user to
select a list entry.
> Can you suggest some resources, where sample
> codes are given for these kind of manipulations..?


From the questions you ask, it would appear to me that you need some basic,
novice Access user training/education, although you seem familiar with some
(server) database terminology (such as 'cursor').

I'd suggest you start by investing in a simple self study book such as
"Microsoft Access Step-by-Step" from Microsoft Press -- it is a very good
book for beginning Access users (but see below). Another Microsoft Press
Book that starts at the beginning and goes deeper is "Microsoft Access 2003
Inside Out" by John Viescas - I strongly recommend this one. A third-party
book that I have used in past editions is Roger Jenning's "Special Edition
Using Access <version>". There are a couple of other series that I suggest,
later in your study, Dr. Rick Dobson's "Programming Microsoft Access
<version>" is good for moving from power-user to developer with an emphasis
on VBA (though I tend to think he underemphasizes DAO and overemphasizes
ADO), and a second series that is a concensus choice of serious Access
developers, the Access Developer's Handbook, by Litwin, Getz, et al, from
Sybex -- but you are some study away from being ready for either of these.

If you are using Access 2002 or 2003, the training courses that you can
reach via
http://office.microsoft.com/training...EC790020111033
are free and may get you started so that you can bypass the "Step by Step"
book.

Welcome to the world of Access and good luck with your studies. One piece of
advice: don't expect Access to be something else with which you are
familiar, either scaled down or up -- cherish it for itself, because it is a
really good product that extends far beyond the "little desktop database"
that some have thought it to be.

Larry Linson
Microsoft Access MVP


That was awesome, Larry. If you have any insight about the tabledef
problem I posted about two lines up, let me know.

ssb, I assumed you were a developer due to your use of "cursor". If my
advice presumed too much knowledge, regrets.

Nov 13 '05 #4

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

Similar topics

27
by: DraguVaso | last post by:
Hi, The Multi column comboBox is a well spoken control, that a lot of people desire, and a lot of people buildtheir own. I tested a lot of them, but none really was what i wanted to have. But...
2
by: Susan Bricker | last post by:
Greetings! Still the same application (as previous posts). I worked on the app while at work (don't tell my boss ... cause this is just for fun and not work related) and the form was working,...
2
by: Arnie | last post by:
I have searched this NG for datasheet column width posts and have read many of them. None of them seem to address what I would like to do. I'm beginning to think what I want can't be done. Here...
0
by: Henry | last post by:
I have a dataset dsMain in which I have two tables The table period has columns like period_id, name, root_org_id.... The table organization has org_id, name, parent_id, hier_path, level,...
0
by: gerry | last post by:
I want to populating an asp list box from a simple access lookup list (single column not a table.)I don't want to create tables just for lookups as the values will be descriptive only and will...
2
by: John Ninan | last post by:
I am creating Dynamic Usercontrol in Asp.net application. In this application I have a combobox(aspx Page). Which contains various items. Based on item selected I am dynamically populating...
3
by: Eric | last post by:
Im populating a combobox from query results like that below. This works great for populating the box, but I dont want the selected text, but the ID info associated with the selection. The query...
0
by: Paul Hadfield | last post by:
I'm looking for thoughts on the "correct" design for this problem (DotNet 2.0 - in winforms, but that's not so important). I've got two combo boxes (combo1 and combo2), both are populating via...
2
by: anatanat | last post by:
hello :) I want to bind a combobox to a specific column in a DataTable. I want the combobox items to display distinct values. I tried: combo.datasource = dataTable; combo.DisplayMember =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.