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

ACCESS MODULE FROM ASP

Status
Not open for further replies.

MPCWIZZARD

Technical User
Feb 3, 2003
4
US
I NEED TO RUN A MODULE IN ACCESS USING ASP THE MODULE IS CALLED LOOKUP2
AND AT PRESENT HAS A SUB THAT IS EnterValueOfNotes

IM NOT A PROGRAMER SO ALL THE HELP ON THIS WOULD BE APPED.

 
I'm not exactly sure what you are trying to do. However you cannot directly call an Access Module from ASP. What you would is either rewrite the code in VBScript, or you can compile it into a dll.

You need to give more details.

 
you are talking way over my head i will past the mod and if you would tell me what the best thing to do is

doug@papermoneyworld.net

Option Compare Database
Option Explicit

Public Sub EnterValueOfNotes100yen()
'=====> This requires a reference in TOOLS > References
'=====> to "Microsoft DAO 3.5 Object Library" or 3.6
'
'=====> To run it, press CTRL + G
'=====> In the bottom box, type "EnterValueOfNotes"
'=====> It takes about 2 minutes to run.

Dim db As Database
Dim rsNotes As DAO.Recordset
Dim rsLookup As DAO.Recordset
Dim SQL As String
Dim Lookup As Currency
Set db = CurrentDb
Set rsNotes = db.OpenRecordset("tb_notes100")
Debug.Print "start " & Time

Do Until rsNotes.EOF
If rsNotes!currency_value = 1000 Then
SQL = "Select * from Pricelist100yen" & _
" where series=" & "'" & Trim(rsNotes!Series) & "'" & _
" and denomnation = " & rsNotes!currency_value & _
" and Left(trim(start),1) ='" & Left(Trim(rsNotes!serialnumber), 1) & "'"
Else
'==== CHANGE ID NUMBER TO STARTING NUMBER ====
SQL = "Select * from Pricelist100yen" & _
" where series=" & "'" & Trim(rsNotes!Series) & "'" & _
" and denomnation = " & rsNotes!currency_value & _
" and Len(trim(start)) =" & Len(Trim(rsNotes!serialnumber)) & _
&quot; and start <= &quot; & &quot; '&quot; & Trim(rsNotes!serialnumber) & &quot;'&quot; & _
&quot; and end >= &quot; & &quot; '&quot; & Trim(rsNotes!serialnumber) & &quot;'&quot;
End If

Set rsLookup = db.OpenRecordset(SQL)
If rsLookup.RecordCount = 0 Then
Lookup = 0
Else
Select Case UCase(rsNotes!condition)
Case &quot;Rag&quot;
Lookup = rsLookup!rag
Case &quot;VG&quot;
Lookup = rsLookup!vgood
Case &quot;F&quot;
Lookup = rsLookup!fine
Case &quot;VF&quot;
Lookup = rsLookup!vfine
Case &quot;XF&quot;
Lookup = rsLookup!efine
Case &quot;AU&quot;
Lookup = rsLookup!au
Case &quot;UNC&quot;
Lookup = rsLookup!UNC
Case &quot;CU&quot;
Lookup = rsLookup!CU
Case &quot;CCU&quot;
Lookup = rsLookup!CCU
Case &quot;GCU&quot;
Lookup = rsLookup!GCU
Case Else
Lookup = 0
End Select
End If
rsNotes.Edit
rsNotes!Value = Lookup
rsNotes.Update

rsNotes.MoveNext
Loop

rsNotes.Close
rsLookup.Close
db.Close
Debug.Print &quot;end &quot; & Time

Set rsNotes = Nothing
Set rsLookup = Nothing
Set db = Nothing
End Sub
 
Ok for starters you will need to convert to ADO not DAO. If this is all you have then your best bet is to put this into one asp page. You will need to do this in a VBscript, what database are using?
 
If it is access 2000/xp you can data access pages, although I am not a big fan. The other is to simply rewrite the module into an asp page.


Like this:


<%
' Waits until all the asp is done before dumping the text to the browser
response.buffer = true

dim accessdb, cn, rs, sql
' Name of the Accessdb being read
accessdb=&quot;mydb&quot;

' Connect to the db with a DSN-less connection
cn=&quot;DRIVER={Microsoft Access Driver (*.mdb)};&quot;
cn=cn & &quot;DBQ=&quot; & server.mappath(accessdb)

' Create a server recordset object
Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)

' Select all data from the table the_bird
sql = &quot;select * from whatever&quot;

' Execute the sql
rs.Open sql, cn
%>

<html>
<body>
<table BORDER=&quot;1&quot; align=&quot;center&quot;>
<tr>
<td>Year</td>
<td>Team</td>
<td>W</td>
<td>L</td>
<td>G</td>
<td>GS</td>
<td>CG</td>
<td>IP</td>
<td>H</td>
<td>BB</td>
<td>SO</td>
<td>ShO</td>
<td>ERA</td>
</tr>

<%
' Move to the first record
rs.movefirst

' Start a loop that will end with the last record
do while not rs.eof
%>

<tr>
<td>
<%= rs(&quot;year&quot;) %>
</td>

<td>
<%= rs(&quot;team&quot;) %>
</td>

<td>
<%= rs(&quot;w&quot;) %>
</td>

<td>
<%= rs(&quot;l&quot;) %>
</td>

<td>
<%= rs(&quot;g&quot;) %>
</td>

<td>
<%= rs(&quot;gs&quot;) %>
</td>

<td>
<%= rs(&quot;cg&quot;) %>
</td>

<td>
<%= rs(&quot;ip&quot;) %>
</td>

<td>
<%= rs(&quot;h&quot;) %>
</td>

<td>
<%= rs(&quot;bb&quot;) %>
</td>

<td>
<%= rs(&quot;so&quot;) %>
</td>

<td>
<%= rs(&quot;sho&quot;) %>
</td>

<td>
<%= rs(&quot;era&quot;) %>
</td>
</tr>

<%
' Move to the next record
rs.movenext
' Loop back to the do statement
loop %>
</table>

</html>

<%
' Close and set the recordset to nothing
rs.close
set rs=nothing

response.flush
response.end
%>

 
your right i was using access 2k
ill work on this and let you know

thanks

doug
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top