Still learning ASP so bear with me.
What is the difference between these two? I was using an Access Data
Access Page and needed to create a custome search box. Someone indicated I
needed to create a stored procedure and helped me with some code.
However, Access saved the code I inputed as a query, which runs well in
Access but my DAP or my code is not working with it. Then I heard you need
to create a stored procedure in SQL server or some tool like that.
I am thoroughly confused on this.
If I can call an Access query from my DAP please tell me if this code is
correct. I get a type mismatch error on FindText:
<SCRIPT language=vbscript event=onclick for=btnSearch>
If txtSearch.value <> "" Then
FindText()
Else
MsgBox("Please enter a search string.")
End If
</SCRIPT>
<SCRIPT language=vbscript>
Sub FindText()
Dim rst
adUseServer=2
adOpenStatic=3
adLockOptimistic=3
Set rst = CreateObject("ADODB.Recordset")
rst.CursorLocation = adUseServer
'call a stored procedure that takes a parameter
rst.Source = "uspName '" & txtSearch.value & "'"
rst.ActiveConnection
MSODSC.DataPages.Item(0).Recordset.ActiveConnection
rst.CursorType = adOpenStatic
rst.LockType = adLockOptimistic
rst.Properties("reqForm").Value ="MyTable"
rst.Open
'I have a few cbos that filter the original recordset. I want the
existing filter to apply to the search
'results above. If you are just searching the entire table, then you
can omit this.
Dim strWhere
If cboID.value <> "" Then
strWhere = strWhere & "ID=" & cboID.value & " AND "
End If
If cbo2.value <> "" Then
strWhere = strWhere & "fullName=" & cbo2.value & " AND "
End If
If cbo3.value <> "" Then
strWhere = strWhere & "FowardTo=" & cbo3.value & " AND "
End If
If cbo4.value <> "" Then
strWhere = strWhere & "OpenClosed=" & cbo4.value & " AND "
End If
If strWhere = "" Then
rst.Filter = ""
Else
strWhere = Left(strWhere, Len(strWhere) - 5)
rst.Filter = strWhere
End If
'swap out the original bound data with the search results
MSODSC.SetRootRecordset "MyTable", rst
uspName is referred to as a query by Access.
Robert