Adding ID field to another column with data already in it.

D

databaseboy2005

I have a field called image. it is hidden and automatically sends the value
"images/nowserving/image0--.gif". Where "--" needs to be the same as the ID
number. ex "images/nowserving/image010.gif". Is there anyway to do this
automatically? Currently I am manually modifing the "--" in the database to
match the ID#.
 
T

Thomas A. Rowe

You could skip the process of storing the image name in the database altogether, if you will always
have a image for the record. Then to display the image on your page, do:

"images/nowserving/image<%=recordset("ID")%>.gif".

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
D

databaseboy2005

This may come in handy, but I dont think this will accomplish my goal. Here
is what I am doing. This site is a "help desk" type system. I have "now
serving" images that are displayed on a results page ONLY if an "x" appears
in the status column. This way, as we help each person, i can just place an x
in the record that we are helping and it will automatically display the now
serving image. The path to that image is "images/nowserving/image__.gif".
Does this make sense?
 
T

Thomas A. Rowe

If you are adding a record: The problem is if you are currently using the Access Autonumber field,
you will not know the record number until after the record is written to the database.

If you are editing/updating the record: Then just make sure that the ID number is being requested in
your query, unless using * which will give it to you automatically, then you would create a hidden
form field like:

<input type="hidden" name="fieldname" value="images/nowserving/image<%=recordsetname("ID")%>.gif">

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
D

databaseboy2005

Does recordsetname refer to "results"? i did this but it did not work.
However, i am a little unclear about the * thing.
 
T

Thomas A. Rowe

Ok,

recordsetname is the name of your recordset, if use the FP database component, rename recordsetname
to:

fp_rs


* is the shortcut method of retrieving all the fields in the record, without have to specify each
fieldname.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
D

databaseboy2005

Thomas, i appreciate your patience....you must think i am an idiot by now. I
am getting the following error on the page when I added the hidden field.

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'fp_rs'

/techhelp/tech.asp, line 283
 
T

Thomas A. Rowe

Paste the code from line 283 in to a reply.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
T

Thomas A. Rowe

Also include a few lines above and below line 283.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
D

databaseboy2005

Intesting, but the code on the referenced page only goes up to 200. I think
it may be refering to the "_fpclass/fpdbrgn1.inc" file...but again not sure.
The code below is from the reference page and starts on line 147-200.


<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="6079" --><tr>
<td><img src= "<!--webbot bot="DatabaseResultColumn"
s-columnnames="Status,ID,Name,Room,Email,Image,Problem,Remote_computer_name1,User_name1,Browser_type1,Timestamp1"
s-column="Image" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE"
clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Image<font
size="-1">&gt;&gt;</font>" startspan
--><%=FP_FieldVal(fp_rs,"Image")%>"><!--webbot bot="DatabaseResultColumn"
endspan i-checksum="8552" --></td>
</tr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE"
b-menuformat="FALSE" u-dbrgn2="_fpclass/fpdbrgn2.inc" i-groupsize="0"
clientside tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00"
width="100%"><font color="#000000">This is the end of a Database Results
region.</font></td></tr>" startspan --><!--#include
file="_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="62730" --></tbody>

</table>

<p> </td>
</tr>
<tr>
<td width="137" height="48">
<p align="left"><b><font face="Arial">Room#: </font></b></p>
</td>
<td height="48" width="265"><font face="Arial">
<!--webbot bot="Validation" b-value-required="TRUE" i-minimum-length="1"
i-maximum-length="15" --><input type="text" name="Room" size="9"
maxlength="15" tabindex="2"></font></td>
</tr>
<tr>
<td width="137" height="50"><b><font face="Arial">Email
Address: </font></b></td>
<td height="50" width="265"><font face="Arial">
<a href="mailto:">
<!--webbot bot="Validation" b-value-required="TRUE" i-minimum-length="1"
i-maximum-length="25" --><input type="text" name="Email" size="20"
maxlength="25" tabindex="3"></a></font></td>
</tr>
<tr>
<td width="137"><b><font face="Arial">Problem or Need:<br>
Be Specific!! </font></b></td>
<td width="265"><font face="Arial">
<!--webbot bot="Validation" b-value-required="TRUE" i-minimum-length="1"
i-maximum-length="400" --><textarea rows="6" name="Problem" cols="25"
tabindex="4"></textarea></font></td>
</tr>
<tr>
<td width="402" colspan="2">

<p align="left">
<input type="submit" value="Submit" name="B1" style="border: 8px outset
#FF0000" tabindex="5"></p>
<p class="MsoNormal"><i><b><font face="Arial" size="1">Web Page Created By
John Rose<br>
2004/2005</font></b></i></p>
</td>
</tr>
</table>

<input type="hidden" name="status" value="o">
<input type="hidden" name="ID" value=""autonumber"">


<input type="hidden" name="image"
value="images/nowserving/image<%=fp_db("ID")%>.gif">


</form>

</body>
 
T

Thomas A. Rowe

Try this:

<input type="hidden" name="status" value="o">
<input type="hidden" name="ID" value=""autonumber"">
<input type="hidden" name="image" value="images/nowserving/image<%=FP_FieldVal(fp_rs,"ID")%>.gif">

If the above doesn't work, maybe Kathleen has some thoughts since she works with the FP Database
components, whereas I hand code everything.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================


databaseboy2005 said:
Intesting, but the code on the referenced page only goes up to 200. I think
it may be refering to the "_fpclass/fpdbrgn1.inc" file...but again not sure.
The code below is from the reference page and starts on line 147-200.


<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="6079" --><tr>
<td><img src= "<!--webbot bot="DatabaseResultColumn"
s-columnnames="Status,ID,Name,Room,Email,Image,Problem,Remote_computer_name1,User_name1,Browser_type1,Timestamp1"
s-column="Image" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE"
clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Image<font
size="-1">&gt;&gt;</font>" startspan
--><%=FP_FieldVal(fp_rs,"Image")%>"><!--webbot bot="DatabaseResultColumn"
endspan i-checksum="8552" --></td>
</tr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE"
b-menuformat="FALSE" u-dbrgn2="_fpclass/fpdbrgn2.inc" i-groupsize="0"
clientside tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00"
width="100%"><font color="#000000">This is the end of a Database Results
region.</font></td></tr>" startspan --><!--#include
file="_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="62730" --></tbody>

</table>

<p> </td>
</tr>
<tr>
<td width="137" height="48">
<p align="left"><b><font face="Arial">Room#: </font></b></p>
</td>
<td height="48" width="265"><font face="Arial">
<!--webbot bot="Validation" b-value-required="TRUE" i-minimum-length="1"
i-maximum-length="15" --><input type="text" name="Room" size="9"
maxlength="15" tabindex="2"></font></td>
</tr>
<tr>
<td width="137" height="50"><b><font face="Arial">Email
Address: </font></b></td>
<td height="50" width="265"><font face="Arial">
<a href="mailto:">
<!--webbot bot="Validation" b-value-required="TRUE" i-minimum-length="1"
i-maximum-length="25" --><input type="text" name="Email" size="20"
maxlength="25" tabindex="3"></a></font></td>
</tr>
<tr>
<td width="137"><b><font face="Arial">Problem or Need:<br>
Be Specific!! </font></b></td>
<td width="265"><font face="Arial">
<!--webbot bot="Validation" b-value-required="TRUE" i-minimum-length="1"
i-maximum-length="400" --><textarea rows="6" name="Problem" cols="25"
tabindex="4"></textarea></font></td>
</tr>
<tr>
<td width="402" colspan="2">

<p align="left">
<input type="submit" value="Submit" name="B1" style="border: 8px outset
#FF0000" tabindex="5"></p>
<p class="MsoNormal"><i><b><font face="Arial" size="1">Web Page Created By
John Rose<br>
2004/2005</font></b></i></p>
</td>
</tr>
</table>

<input type="hidden" name="status" value="o">
<input type="hidden" name="ID" value=""autonumber"">


<input type="hidden" name="image"
value="images/nowserving/image<%=fp_db("ID")%>.gif">


</form>

</body>

[QUOTE]
Also include a few lines above and below line 283.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)
http://www.ycoln-resources.com
FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
[/QUOTE][/QUOTE]
 
Top