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... 3 3061
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.
"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
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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,...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
|
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 =...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: linyimin |
last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
|
by: erikbower65 |
last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA:
1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: Rina0 |
last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
| |