Run MS-Access Query

S

Saber

I've two queries in MS-Access, named "Archive" and "final", how can I excute
them?

perhaps it helps:

----Archive Query------------------------------
SELECT LAST(a.id) AS PostID, LAST(a.posttitle) AS PostTitle,
LAST(a.posttext) AS PostText, LAST(a.posttype) AS PostType, LAST(a.postdate)
AS PostDate, LAST(a.posttopic) AS PostTopic, LAST(a.authorid) AS AuthorID
FROM tblPosts AS a INNER JOIN tblPosts AS b ON a.id<=b.id
GROUP BY a.id
HAVING COUNT(*) Between 5 And 10;
---------------------------------^------^^------


----final Query---------------------------------
SELECT Archive.*, tblAuthors.*
FROM Archive INNER JOIN tblAuthors ON Archive.AuthorID=tblAuthors.ID;
------------------------------------------------


one more thing: I want to send variables instead of 5,10 in first query. It
is easy if I want just excute first query, but I want to excute both.
I pass strSql to a function: showRpt(dtrWeblog, rptWeblog, strSql)


Sub showRpt(ByVal dtr As OleDbDataReader, ByVal rpt As Repeater, ByVal str
As String)

cmdSqlWeblog = New OleDbCommand(str, con)

ConnectDB(con)

dtr = cmdSqlWeblog.ExecuteReader

rpt.DataSource = dtr

rpt.DataBind()

dtr.Close()

DisconnectDB(con)

cmdSqlWeblog.Dispose()

End Sub



Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top