|
-
Mar 1st, 2002, 05:20 PM
#1
Thread Starter
Lively Member
Stupid Question (sql)
Ok this is a stupid question and I am killing myself for it but here it goes...
How do i use a SQL statement to populate a recordset instead of just opening the recordset. I need to sort some data before i load it in.
Thanks
-
Mar 1st, 2002, 05:53 PM
#2
Thread Starter
Lively Member
More info
Set DB = OpenDatabase(App.Path & "\PNMA.mdb")
SqlStmt = "SELECT * FROM Genealogy ORDER BY Parent"
Set RSGene = DB.OpenRecordset("Genealogy", 1)
RSGene.Open SqlStmt
Here is the error I get..
"Object doesn't support this property or method (Error 438)"
-
Mar 2nd, 2002, 02:24 AM
#3
Addicted Member
try this
Dim rst As New ADODB.Recordset
Dim Sqlstr as String
cnn.Provider = 'jour Provider voor .mdb databases access 2000
cnn.ConnectionString = App.Path & "\Data\dbFakt.mdb"
cnn.Open
cmd.ActiveConnection = cnn
sqlstr = "Select * From jour table"
cmd..CommandText = sqlstr
rst.Open cmd
this should do it.
-
Mar 2nd, 2002, 08:05 AM
#4
Frenzied Member
No such thing as a stupid question...
The problem is that you're opening the table and then trying to do it again using your SQL statement. Try this...
VB Code:
Set DB = OpenDatabase(App.Path & "\PNMA.mdb")
SqlStmt = "SELECT * FROM Genealogy ORDER BY Parent"
Set RSGene = DB.OpenRecordset(SqlStmt , 1)
'RSGene.Open SqlStmt
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|