How to retrieve values from an SQL-query

  • Thread starter Thread starter Shiva
  • Start date Start date
S

Shiva

Hi,

I'm trying to get familiar with VBA-programming in Access 2000.
My question is: how do I execute a query in VBA and retrieve the results of
that query? It has to be an "on-the-fly"-query, so something like this (in
pseudocode):

- execute query "SELECT name FROM emp"
- while not EOF
get name value and assign it another variable
get next record
- wend

The query will be executed in an event.

Thanks in advance!
 
Shiva said:
I'm trying to get familiar with VBA-programming in Access 2000.
My question is: how do I execute a query in VBA and retrieve the results of
that query? It has to be an "on-the-fly"-query, so something like this (in
pseudocode):

- execute query "SELECT name FROM emp"
- while not EOF
get name value and assign it another variable
get next record
- wend

The query will be executed in an event.


Check OpenRecordset in Help.

It's rather unusual to want to retrieve all employee names
in an event procedure. Are you sure you need to do this?
 
Check OpenRecordset in Help.
Thanks, I'll check it out!
It's rather unusual to want to retrieve all employee names
in an event procedure. Are you sure you need to do this?

Eh..no. It was just an example, 'cause I haven't built the query yet and
it's the commands etc. I'm looking for..
 
Back
Top