Re: Parameter quires in Data access pages



Thank you ken this was a great help for me I really appreciate it.

"Ken Snell (MVP)" wrote:

VBScript is similar to VBA, but has many differences. Here is the pertinent
script code from the DAP that writes the cookie to the PC:

----------------------------------------
This is the script that reads, writes, and deletes cookies on the PC:


' Start of script
<SCRIPT language=VBScript>


Sub SetVariable(strVariableName, varVariableValue)
Document.Cookie = strVariableName & "=" & varVariableValue
End Sub

Sub KillVariable(strVariableName)
SetVariable strVariableName, "NULL;expires=Monday, 01-Jan-95 12:00:00
GMT"
End Sub

Function ReadVariable(strVariableName)
' These five variables are used in the string manipulation
' code that finds the variable in the cookie.
Dim intLocation
Dim intNameLength
Dim intValueLength
Dim intNextSemicolon
Dim strTemp
Dim NOT_FOUND
NOT_FOUND = "NOT_FOUND"

' Calculate the length and location of the variable name.
intNameLength = Len(strVariableName)
intLocation = Instr(Document.Cookie, strVariableName)

' Check for existence of the variable name.
If intLocation = 0 Then
' Variable not found, so it can't be read.
ReadVariable = NOT_FOUND
Else
' Get a smaller substring to work with.
strTemp = Right(Document.Cookie, Len(Document.Cookie) - intLocation + 1)

' Check to make sure we found the full string, not just a
' substring.
If Mid(strTemp, intNameLength + 1, 1) <> "=" Then
' Oops, only found substring, not good enough.
ReadVariable = NOT_FOUND

' Note that this will incorrectly give a "not found" result if
' and only if a search for a variable whose name is a substring
' of a preceding variable is undertaken. For example, this will
' fail:
' Search for: MyVar
' Cookie contains: MyVariable=2;MyVar=1

Else
' Found full string.
intNextSemicolon = Instr(strTemp, ";")

' If not found, get the last element of the cookie.
If intNextSemicolon = 0 Then intNextSemicolon = Len(strTemp) + 1
' Check for empty variable (Var1=;)
If intNextSemicolon = (intNameLength + 2) Then
' Variable is empty.
ReadVariable = ""
Else
' Calculate value normally.
intValueLength = intNextSemicolon - intNameLength - 2
ReadVariable = Mid(strTemp, intNameLength + 2, intValueLength)
End If
End If
End If
End Function
</SCRIPT>
'End of script

----------------------------------------
This is the script that calls the cookie subroutines when you click the
button on the DAP, and then navigates to the "show me" DAP:


'Start of script
<SCRIPT language=vbscript event=onclick for=cmdFind>
<!--

Dim sFind
Dim URL

Const cstrCookieName = "TextString"

URL = "ShowDAP.htm"

' Values in the text box are stored in the value property.
sFind = txtFind.Value

SetVariable cstrCookieName, sFind

window.navigate(URL)

-->
</SCRIPT>
'End of script
--

Ken Snell
<MS ACCESS MVP>



"Ramon" <Ramon@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:61947892-BFDE-4DE5-9E12-CFAE63070085@xxxxxxxxxxxxxxxx
Hello Ken,

Im sorry i looked into the code on thr DAP, and since i have never writing
any code i really didnt understand how or what parts ro duplicate inorder
to
make it work for me. I read some information about param names also
something
about document.cookies but i just coulld not get a great understanding
from
it. I know this may be extreme but if there is a way for you to explain
it
to me via email it would be great. You can email me @
mrramonbrown@xxxxxxxxx

"Ken Snell (MVP)" wrote:

The script in the first DAP contains the code for doing that.
Essentially,
you call a subroutine that is in the DAP's module that writes the cookie
with the parameter name and the parameter value.

Take a look at the VBScript and then post back with specific questions.

--

Ken Snell
<MS ACCESS MVP>

"Ramon" <Ramon@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0963CCE9-21E8-4ACE-B61C-3949DFB66C35@xxxxxxxxxxxxxxxx
Thanks ken for the info I looked into your sample DB and I was unable
to
view
how to complete the process of writing the parameters into the cookies.
can
you please explain how it is done. Thanks in advance for all of your
help

"Ken Snell (MVP)" wrote:

You can write the parameter values into cookies and pass them to the
other
page that way. I have a sample database that uses cookies to pass a
parameter from one page to another:
http://www.cadellsoftware.org/SampleDBs.htm#FilterDAP

--

Ken Snell
<MS ACCESS MVP>



"Ramon" <Ramon@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0A81C809-A331-4770-9C3F-788B3804F55A@xxxxxxxxxxxxxxxx
I am currently building a database within ms access that display data
based
on parameter quires within access. When I open a data access page it
asks
me
for the parameter "enter start date" and "enter end date". I have
several
pages based on the same parameter. Is it possible to move from one
data
access page to another without having to retype the parameter again?

Example:

Page one GC Monthly Summary links to Call center SLA. via hyperlink.
Once
I
open GC Monthly summary I enter the parameter when I click the
hyperlink
for
Call center SLA I would like the page to use the same dates I
entered
for
the
GC Monthly summary page.

Please assist










.