<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Server.ScriptTimeout = 600 ' This could take a while as the code is not very efficient!
dim conn, conn2
'Set the path to the database
sourceDB = "C:\Inetpub\wwwroot\yourAccessDatabase.mdb"
response.write("Database: " & sourceDB & "<br>")
Set conn=Server.CreateObject("ADODB.connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & sourceDB
Set rs = conn.Execute("SELECT * FROM FORUM_MEMBERS ORDER BY MEMBER_ID;")
do while not rs.EOF
response.write(rs.Fields("MEMBER_ID") & " " & rs.Fields("M_NAME") & " ")
'ok lets count how many posts this user has made
counter = 0
Set conn2=Server.CreateObject("ADODB.connection")
conn2.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & sourceDB
Set rs2 = conn.Execute("SELECT * FROM FORUM_TOPICS WHERE T_AUTHOR=" & rs.Fields("MEMBER_ID") & " ORDER BY TOPIC_ID;")
do while not rs2.eof
counter = counter + 1
rs2.movenext
loop
Set rs2 = conn.Execute("SELECT * FROM FORUM_REPLY WHERE R_AUTHOR=" & rs.Fields("MEMBER_ID") & " ORDER BY REPLY_ID;")
do while not rs2.eof
counter = counter + 1
rs2.movenext
loop
response.write(counter & "<br>")
'update the values
Set rs2 = conn2.Execute("UPDATE [FORUM_MEMBERS] SET [M_POSTS]="& counter &" WHERE [MEMBER_ID]=" & rs.Fields("MEMBER_ID") & ";")
conn2.close
rs.movenext
loop
response.write("Done!")
%>
Moderator Edit: Removed database name.