need a variable in my recordset 
Author Message
 need a variable in my recordset

Hi there,

i'd like to use a recordset, with a variable in it, but i just can't seem to
get it to work. Because i'd like to filter out just the values from other
tables, that are from a specific customer. Who can help me out, please?

What i have got now is:

Dim klantid

klantid = rstklanten.Fields("klantcode").Value

rstfakturen.Open("Select * from faktuurgegevens where klantcode =" +
klantid, optiekdb, _

ADODB.CursorTypeEnum.adOpenDynamic, _

ADODB.LockTypeEnum.adLockOptimistic)



Tue, 26 Oct 2004 03:18:55 GMT  
 need a variable in my recordset
Hi Jan,

You code should look something like this
Dim klantid

klantid = rstklanten.Fields("klantcode").Value

rstfakturen.Open("Select * from faktuurgegevens where klantcode =" &
klantid, optiekdb, , adOpenDynamic, adLockReadOnly)

You must set your cursors etc before you 'start' your query or in the call
as I have done it.

cheers,
Maartin.


Quote:
> Hi there,

> i'd like to use a recordset, with a variable in it, but i just can't seem
to
> get it to work. Because i'd like to filter out just the values from other
> tables, that are from a specific customer. Who can help me out, please?

> What i have got now is:

> Dim klantid

> klantid = rstklanten.Fields("klantcode").Value

> rstfakturen.Open("Select * from faktuurgegevens where klantcode =" +
> klantid, optiekdb, _

> ADODB.CursorTypeEnum.adOpenDynamic, _

> ADODB.LockTypeEnum.adLockOptimistic)



Tue, 26 Oct 2004 03:41:51 GMT  
 need a variable in my recordset
Hi Maartin,

thanx for your help, but unfortunatly this didn't work out, should i
mention, i'm working in dotnet? Does this make a difference? Would you
happen to have another suggestion ?

Thanx in advance,

Jan



Quote:
> Hi there,

> i'd like to use a recordset, with a variable in it, but i just can't seem
to
> get it to work. Because i'd like to filter out just the values from other
> tables, that are from a specific customer. Who can help me out, please?

> What i have got now is:

> Dim klantid

> klantid = rstklanten.Fields("klantcode").Value

> rstfakturen.Open("Select * from faktuurgegevens where klantcode =" +
> klantid, optiekdb, _

> ADODB.CursorTypeEnum.adOpenDynamic, _

> ADODB.LockTypeEnum.adLockOptimistic)



Tue, 26 Oct 2004 03:48:42 GMT  
 need a variable in my recordset
yeah well .net makes a big diffy what are you working in VB7 sorry vb.net I
presume.

you should still be working with & instead of + (+ is in general for C++).
If you build the string into a string and then take the contents of the
string does it contain all
that is required for the sql statement ? if it does copy that string into db
(access or SQL) and run it
there and see what happens. Is the variable a string or no ? if it is a
string remember your single qoutes '
around the string if it is no no need.

If it still does not work send me your code and that table structure ofwhat
you are busy with and I will
give it a bash on this side.

Houdo,
I gaat naar bed.
Maartin.


Quote:
> Hi Maartin,

> thanx for your help, but unfortunatly this didn't work out, should i
> mention, i'm working in dotnet? Does this make a difference? Would you
> happen to have another suggestion ?

> Thanx in advance,

> Jan



> > Hi there,

> > i'd like to use a recordset, with a variable in it, but i just can't
seem
> to
> > get it to work. Because i'd like to filter out just the values from
other
> > tables, that are from a specific customer. Who can help me out, please?

> > What i have got now is:

> > Dim klantid

> > klantid = rstklanten.Fields("klantcode").Value

> > rstfakturen.Open("Select * from faktuurgegevens where klantcode =" +
> > klantid, optiekdb, _

> > ADODB.CursorTypeEnum.adOpenDynamic, _

> > ADODB.LockTypeEnum.adLockOptimistic)



Tue, 26 Oct 2004 05:27:53 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. need a variable for my recordset

2. need a variable in my recordset

3. ADO recordset: Object variable or with block variable not set

4. passing date variable in select statment of recordset variable

5. Object Variable in DAO Recordset

6. How: Use a variable in a recordset instance

7. Using variables for field names in recordset

8. Reference a variable not a Text in a recordset

9. variable names of columns in a recordset

10. use variable to access field of a recordset

11. Problem when I dcelare a variable as Recordset

12. Referencing a recordset item with a variable

 

 
Powered by phpBB® Forum Software