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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use Query as Record Set

Status
Not open for further replies.

maduko

IS-IT--Management
Mar 24, 2003
43
0
0
US
I'm working with a script intended to pull records from a table. It's a long story- but the page is currently getting them via a query.

The following line appears to work- but it's VERY slow. Any suggestions on how to speed it up or call a table but use criteria?

objRS.Open "qryEMAIL" , objConn ,adOpenKeyset ,adLockReadOnly,adCmdTable
 
There is no query. Here is the full script that pulls e-mail addresses from a table. In the mail object the address is inserted using objRS("email") for each message.

.....
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DBQ=" & Server.MapPath("newsletter.mdb")& ";Driver={Microsoft Access Driver (*.mdb)}"
Set objRS = Server.CreateObject("ADODB.RecordSet")
objRS.Open "email" , objConn ,adOpenKeyset ,adLockReadOnly,adCmdTable
......
 
So is email a query inside access?
If it is then you can transfer the sql from sql view of the query and use it directly. CAn you show me that as well? Or am i missing somthing lol

}...the bane of my life!
 
The "email" in the above script refers to a table.

I do have a query in the DB however, which is what precluded the question. It's nothing more than a select * where email <> "".

Pulling from the table doesn't work because some records do not have email addresses.
 
Ok

Code:
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DBQ=" & Server.MapPath("newsletter.mdb")& ";Driver={Microsoft Access Driver (*.mdb)}"

Set objRS = objConn.execute("SELECT * FROM email")

objRS will contain all of the email records and can be used to loop forward through them

so

Code:
if not objRS.eof then
  do while not objRS.eof
    response.write(objRS("COLUMN_NAME") & "<br>")
    objRS.MoveNext
  loop
end if

}...the bane of my life!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top