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

fp_sDefault to be LOGON_USER

Status
Not open for further replies.

mutiger83

IS-IT--Management
Apr 18, 2005
29
US
I have setup a reslts page in MS Frontpage from a MS Access database. I would like the page to automatically load all records associated wiht the current logged in user when the page loads. I have a field in the DB that stores the user name -- it is called user.

How do I modify this line of the code fp_sDefault="user=" to get the users LOGON_USER id?

Sorry I am sure this is simple....

Thanks!
 
Sorry....let me try to explain this a bit better and provide some code...

Here is what I have going on....

I have a MS Access Database that I am querying. I have it setup with a connection called "DATABASE1". There is a table in the database called "Favorites" I used MS Frontpage to create a simple results table that displays the information contained in the Favorites table. One of the fields in teh table is called "USER" and contains the MS user login. Currently I have a hidden field on the form that captures the users login information by using <input NAME="User" input Type="HIDDEN" VALUE="<%=Request.ServerVariables("LOGON_USER")%>">. However, in order to invoke the query and display the resutls the user has to click on the "SUBMIT" button. I would like the query to automatically run when the page is loaded. So, I know if I "hard code" the user's name after fp_sDefault= it will do that. HOwever, set this up to equal whatever teh current logged user ID is equal to? I tried something like
fp_sDefault= Request.ServerVariables("LOGON_USER") but it does not work.....

Hopefully that helps....THANKS!


----CODE---


<table width="153" border="0" align="left" cellpadding="2" cellspacing="0">
<tr>
<td align="left" valign="top" bgcolor="ffffff">
<div id="list_nav">
<div align="left">
<ul class="list_nav_ul">
<li class="list_nav_li">
<br><br><Br><font size="2">
My Favorites</font><br><br>
<table width="90%" border="1">
<thead>
<tr>
<th ALIGN="LEFT"><b>Pager #</b></th>
<th ALIGN="LEFT"><b>Alias</b></th>
</tr>
</thead>
<tbody>
<!--webbot bot="DatabaseRegionStart" s-columnnames="User,Fav_Name,Fav_Nbr" s-columntypes="202,202,202" s-dataconnection="Database1" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="TRUE" s-recordsource="Favorites" s-displaycolumns="Fav_Name,Fav_Nbr" s-criteria="[User] EQ {User} +" s-order s-sql="SELECT * FROM Favorites WHERE (User = '::User::')" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="User=" s-norecordsfound="No records returned." i-maxrecords="256" i-groupsize="25" botid="2" u-dblib="_fpclass/fpdblib.inc" u-dbrgn1="_fpclass/fpdbrgn1.inc" u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the start of a Database Results region. The page must be fetched from a web server with a web browser to display correctly; the current web is stored on your local disk or network.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" startspan --><!--#include file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Favorites WHERE (User = '::User::')"
fp_sDefault="User='::FavID::'"
fp_sNoRecords="<tr><td colspan=2 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="Database1"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=25
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&User=202&Fav_Name=202&Fav_Nbr=202&"
fp_iDisplayCols=2
fp_fCustomQuery=False
BOTID=2
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan --><tr>
<td>
<a href="#" onclick="document.getElementById('theTextbox').value = this.innerHTML">
<!--webbot bot="DatabaseResultColumn" s-columnnames="User,Fav_Name,Fav_Nbr" s-column="Fav_Name" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="&lt;font size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Fav_Name&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;" startspan --><%=FP_FieldVal(fp_rs,"Fav_Name")%><!--webbot bot="DatabaseResultColumn" endspan --></td>
<td>

<!--webbot bot="DatabaseResultColumn" s-columnnames="User,Fav_Name,Fav_Nbr" s-column="Fav_Nbr" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="&lt;font size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Fav_Nbr&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;" startspan --><%=FP_FieldVal(fp_rs,"Fav_Nbr")%><!--webbot bot="DatabaseResultColumn" endspan --></td>
</tr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="_fpclass/fpdbrgn2.inc" i-groupsize="25" clientside tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the end of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;TR&gt;&lt;TD VALIGN=MIDDLE COLSPAN=64&gt;&lt;NOBR&gt;&lt;INPUT TYPE=Button VALUE=&quot; |&lt; &quot;&gt;&lt;INPUT TYPE=Button VALUE=&quot; &lt; &quot;&gt;&lt;INPUT TYPE=Button VALUE=&quot; &gt; &quot;&gt;&lt;INPUT TYPE=Button VALUE=&quot; &gt;| &quot;&gt; [1/25]&lt;/NOBR&gt;&lt;BR&gt;&lt;/td&gt;&lt;/tr&gt;" startspan --><!--#include file="_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan --></tbody>
</table>


<form BOTID="2" METHOD="POST" action="favs.asp">
<input type="hidden" name="fpdbr_2_PagingMove" value=" |&lt; ">
<table BORDER="0">
<tr>

<td>
<input NAME="User" input Type="HIDDEN" VALUE="<%=Request.ServerVariables("LOGON_USER")%>"></td>
</tr>
</table>
<br>
<input TYPE="Submit"><!--webbot bot="SaveAsASP" clientside suggestedext="asp" preview=" " startspan --><!--webbot bot="SaveAsASP" endspan --><p>&nbsp;</p>
</form>
 
One small edit to the code shown...

The fp_sDEfault line should read

fp_sDefault="User="

to match how I currently have it configured.
 
When you set fp_sDefault = Request.ServerVariables("LOGON_USER"), I don't see exactly what you do with the variable fp_sDefault.

You should be able to put your query statement as this:
"SELECT * FROM Favorites WHERE User = " & Request.ServerVariables("LOGON_USER").

To test if there is any info in Request.ServerVariables("LOGON_USER"), put:

Response.Write(Request.ServerVariables("LOGON_USER");
Response.End;


If you see there is something, then the query changes above should work.


[monkey][snake] <.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top