
March 1st, 2000, 12:56 PM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,578
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
|
<i><b>Originally posted by : Mike B (mikeb811@hotmail.com)</b></i><br />You can try the code below, you will have to change the database information and the query name but it should work.<br /><br /><!-- #include file="adovbs.inc" --><br /><html><br /><head><title>Test</title></head><br /><BODY><br /><%<br />Set conn = Server.CreateObject("ADODB.Connection")<br />driv = "driver={Microsoft Access Driver (*.mdb)}"<br />conn.Open driv & ";dbq={dbloc goes here}"<br /><br />set objCmd = server.CreateObject("ADODB.Command")<br />objCmd.CommandType=adCmdStoredProc<br />objCmd.CommandText="Query1" ' should be Access query name<br />objCmd.ActiveConnection=conn<br /><br />set rs = objCmd.Execute<br />for each f in rs.fields<br /> response.write("field = " & f.name&"<br>")<br />next<br /><br />rs.close<br />set rs = nothing<br />set objCmd = nothing<br />conn.close<br />set conn = nothing<br />%><br /></body><br /></html><br /><br />Hope this helps.<br /><br />Mike<br /><br /><br /><br />------------<br />Daniel Macfie at 2/29/2000 12:28:24 PM<br /><br />Wonder if you could help...<br /><br />I'm trying to retrieve some information from some so-called "Query" from within Access, but am unable to for some reason. Retrieving info. from a "Table" is working fine, but would anyone know the syntax for retrieving from a "Query"? (It seems that simply entering the name doesn't work, and the name for the "Query" isn't recognised.)<br /><br />I'm totally stuck!<br /><br />Many thanks for your help in advance.<br /><br />Daniel Macfie.
|