Using a query result as a variable in code 
Author Message
 Using a query result as a variable in code

I am trying to use the result of a query as a variable in code and I do not
seem able to get it working. The story is as follows:

I am using a pass-through query in Access calling for a Sequence number in
Oracle. (Yes this app is supposed to ty into an Oracle Backend). That query
returns a value which I would like to use while loading various records
(the main record and the children which use the sequence number as a
foreign key).

Has anybody experience with this, and could somebody maybe sent me a piece
of sample code?

Thanks a lot.

Ritsma,

P.S.: if you reply please remove nospam. from my address of reply directly



Fri, 13 Oct 2000 03:00:00 GMT  
 Using a query result as a variable in code

If you had your Oracle table attached to your DB, then you could simply use
something like this in your code:

Dim vntSequenceNbr

vntSequenceNbr = DMax("[SequenceNbr]", "[MyOracleTable]") + 1

If it is possible that this might return a Null, then you could use:

vntSequenceNbr = Nz(DMax("[SequenceNbr]", "[MyOracleTable]"), 0) + 1

You may have criteria to specify for the DMax?

--
Kipp Woodard (MS Access MVP)

MESA Solutions -  http://www.mesahq.com
7800 Highway 20 West
Tower Building, 4th floor
Huntsville, AL 35807

(205) 864-0400

Quote:
>I am trying to use the result of a query as a variable in code and I do not
>seem able to get it working. The story is as follows:

>I am using a pass-through query in Access calling for a Sequence number in
>Oracle. (Yes this app is supposed to ty into an Oracle Backend). That query
>returns a value which I would like to use while loading various records
>(the main record and the children which use the sequence number as a
>foreign key).

>Has anybody experience with this, and could somebody maybe sent me a piece
>of sample code?

>Thanks a lot.

>Ritsma,

>P.S.: if you reply please remove nospam. from my address of reply directly




Fri, 13 Oct 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. using a query result to run another query

2. Changing query criteria from code using variables?

3. Native code results different from p-code results

4. Modules: setting a variable in memory to the results of a query (EXCEL AUTOMATION)

5. Placing Result of Query into Variable

6. Assigning the results of a query to a variable (cont)

7. Assigning the results of a query to a variable

8. how do I get an sql query to return result to a variable

9. Saving results of query into variables with multiple types

10. Getting the results of a query into a variable

11. Displaying CorssTab Query results in combination with VBA code

12. Help: Query ran from VBA code return incorrect results

 

 
Powered by phpBB® Forum Software