Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset syntax

Status
Not open for further replies.

tksayy

Programmer
Nov 3, 2008
17
0
0
DE
Hi,

Is there anything wrong in this syntax

Set rs2 = C:\Documents and Settings\Desktop\Codebook.mdb.openRecordset(strsql2)
 
Everything! :)

Set db=Opendatabase("C:\Documents and Settings\Desktop\Codebook.mdb")
Set rs2=db.openRecordset(strsql2)
 
thanks

suppose i have two columns in the recordset and i want to store the values of one column in a array.

if the header of column is valid code

Dim astrvalidcodes As Variant
astrvalidcodes = rs2("validcode")

can i write this or do i have to use a do while loop
 
Have a look at the GetRows method of the DAO.Recordset object or the GetString method of the ADODB.Recordset object.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
i went through it and tried the followin

With rs2
.MoveLast
.MoveFirst
astrvalidcodes = rs2.GetRows(.RecordCount)
'.Close ' assuming you want to do this
End With

but i am getting runtime error 3021
 
What is strsql2 ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
strsql2 = "SELECT label.validcode FROM variablen AS s INNER JOIN label ON s.id=label.variablenid WHERE varname='astrFields(intIx)';"
Set db = OpenDatabase("C:\Documents and Settings\TAYYAPP\Desktop\GIDAS_Codebook.mdb")
Set rs2 = db.OpenRecordset(strsql2)

With rs2
.MoveLast
.MoveFirst
astrvalidcodes = rs2.GetRows(.RecordCount)
'.Close ' assuming you want to do this
End With


if you want me to post the whole code i could
 
i think the problems is in sql statement.
varname = 'astrfields(intx)' as when i give the variable name directly the code works

one more doubt suppose i have a rray with 4 or five values
and i want to check them against some field will this condition work

if value<>array_values
then
 
Code:
strsql2 = "SELECT l.validcode FROM variablen s INNER JOIN label l ON s.id=l.variablenid WHERE varname='[!]" & [/!]astrFields(intIx)[!] & "[/!]'"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top