J
Jackie
I've got a problem with the values of two numeric fields not being equal
when they are.
I am about to update an access database record. I retrieve the record and
display all fields. I use one field value - bookerid - to look up a second
database containing all the 'booker' records, and place the values in a drop
down list so the user can amend the booker if they wish. I want the
originally selected value to appear as 'selected' in the drop down list.
As I couldn't do this within FrontPage I've coded the second lookup myself
(code below). It's working to a point - the database is all in the drop-down
list - but the originally selected value does not appear as selected.
The bookerid on the 1st database is a long integer with no decimal places,
the bbookerid on the 2nd database is an auto-generated number, and the
primary key. I've used IsNumeric() to check whether both these fields are
numeric, and it says they are. The Booker ID field on the amendment form is
called 'bookerid' and has a value of bookerid (from the 1st database) but
displays the booker's name and location (from the 2nd).
To try to find the problem I've displayed the value of the variable booker
and CmdPopulateBooker("bbookerid") on each line of the drop down, and there
are records where both the values match but it's not being picked up as
being 'equal' so not displaying as selected.
I've been stuck on this for 2 days now, and would appreciate any ideas as to
why the value of these two fields is not recognised as equal when it is.
I start off by setting a variable, booker, to the value of the originally
selected bookerid from the first database.
<% booker = FP_FieldHTML(fp_rs,"bookerid")%>
<%
Set DataConn = Server.CreateObject("ADODB.Connection")
Set CmdPopulateBooker = Server.CreateObject("ADODB.Recordset")
%>
<%
DataConn.Open "Tripplanner3"
SQL = "SELECT bbookerid, bfirstname, blastname, blocation FROM bookers order
by blocation, blastname asc"
CmdPopulateBooker.Open SQL, DataConn
%>
<Select Name="bookerid" size="1">
<%While Not CmdPopulateBooker.EOF%>
<% If booker = CmdPopulateBooker("bbookerid") Then %>
<option selected value="<% =CmdPopulateBooker("bbookerid") %>"><%=
CmdPopulateBooker("bfirstname") %> <%= CmdPopulateBooker("blastname")
%> at <%= CmdPopulateBooker("blocation") %></option>
<% else %>
<option value="<%= CmdPopulateBooker("bbookerid") %>"><%=
CmdPopulateBooker("bfirstname") %> <%= CmdPopulateBooker("blastname")
%> at <%= CmdPopulateBooker("blocation") %></option>
<% end if %>
<%
CmdPopulateBooker.MoveNext
Wend
%>
Thanks,
Jackie
Access database, FP2002, XP Pro
when they are.
I am about to update an access database record. I retrieve the record and
display all fields. I use one field value - bookerid - to look up a second
database containing all the 'booker' records, and place the values in a drop
down list so the user can amend the booker if they wish. I want the
originally selected value to appear as 'selected' in the drop down list.
As I couldn't do this within FrontPage I've coded the second lookup myself
(code below). It's working to a point - the database is all in the drop-down
list - but the originally selected value does not appear as selected.
The bookerid on the 1st database is a long integer with no decimal places,
the bbookerid on the 2nd database is an auto-generated number, and the
primary key. I've used IsNumeric() to check whether both these fields are
numeric, and it says they are. The Booker ID field on the amendment form is
called 'bookerid' and has a value of bookerid (from the 1st database) but
displays the booker's name and location (from the 2nd).
To try to find the problem I've displayed the value of the variable booker
and CmdPopulateBooker("bbookerid") on each line of the drop down, and there
are records where both the values match but it's not being picked up as
being 'equal' so not displaying as selected.
I've been stuck on this for 2 days now, and would appreciate any ideas as to
why the value of these two fields is not recognised as equal when it is.
I start off by setting a variable, booker, to the value of the originally
selected bookerid from the first database.
<% booker = FP_FieldHTML(fp_rs,"bookerid")%>
<%
Set DataConn = Server.CreateObject("ADODB.Connection")
Set CmdPopulateBooker = Server.CreateObject("ADODB.Recordset")
%>
<%
DataConn.Open "Tripplanner3"
SQL = "SELECT bbookerid, bfirstname, blastname, blocation FROM bookers order
by blocation, blastname asc"
CmdPopulateBooker.Open SQL, DataConn
%>
<Select Name="bookerid" size="1">
<%While Not CmdPopulateBooker.EOF%>
<% If booker = CmdPopulateBooker("bbookerid") Then %>
<option selected value="<% =CmdPopulateBooker("bbookerid") %>"><%=
CmdPopulateBooker("bfirstname") %> <%= CmdPopulateBooker("blastname")
%> at <%= CmdPopulateBooker("blocation") %></option>
<% else %>
<option value="<%= CmdPopulateBooker("bbookerid") %>"><%=
CmdPopulateBooker("bfirstname") %> <%= CmdPopulateBooker("blastname")
%> at <%= CmdPopulateBooker("blocation") %></option>
<% end if %>
<%
CmdPopulateBooker.MoveNext
Wend
%>
Thanks,
Jackie
Access database, FP2002, XP Pro