View Single Post
  #5 (permalink)  
Old June 20th, 2005, 03:55 PM
cedwards cedwards is offline
Authorized User
 
Join Date: May 2005
Location: , WI, .
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Imar!

I can't believe how novice of a mistake that was! Works perfectly now!


Are you up for one last challenge?

The select multiple table I have in my form specifies what locations to put the data into - I need this to be generated dynamically so I don't try to insert data into a field which already has a record. This is how I tried to do it:

I created a recordset (rssamplelocation) that list all the 'locations' that have been filled with data based on freezer, tower, box. This recordset will show for example 001, 002, 003, 004, 005, 006, etc..

I then created another recordset (rslocation) from a tbl I have that has all the locations (001-100) I thought I could make it work by essentially saying show all locations from tbllocation <> rssamplelocation. It seems that I can't get code it correctly though - when I create the dynamic field it always shows 99 of the 100 records (it omits whatever location I selected to get to the page)

Here is the code for both recordsets - if anyone has a better way of doing this I would happy to try it!

<%
Dim rssampletrack__varnametower
rssampletrack__varnametower = "01"
If (Request.Cookies("tower") <> "") Then
  rssampletrack__varnametower = Request.Cookies("tower")
End If
%>
<%
Dim rssampletrack__varnamebox
rssampletrack__varnamebox = "a"
If (Request.Cookies("box") <> "") Then
  rssampletrack__varnamebox = Request.Cookies("box")
End If
%>
<%
Dim rssampletrack
Dim rssampletrack_numRows

Set rssampletrack = Server.CreateObject("ADODB.Recordset")
rssampletrack.ActiveConnection = MM_sample_tracking_STRING
rssampletrack.Source = "SELECT Location FROM tblsamples WHERE Freezer = '" + Replace(rssampletrack__varnamefreezer, "'", "''") + "' AND Tower='" + Replace(rssampletrack__varnametower, "'", "''") + "' AND Box='" + Replace(rssampletrack__varnamebox, "'", "''") + "'"
rssampletrack.CursorType = 0
rssampletrack.CursorLocation = 2
rssampletrack.LockType = 1
rssampletrack.Open()

rssampletrack_numRows = 0
%>

and the other recordset:


<%
Dim rslocation__MMColParam
rslocation__MMColParam = "rssampletrack"
If ((rssampletrack.Fields.Item("Location").Value) <> "") Then
  rslocation__MMColParam = (rssampletrack.Fields.Item("Location").Value)
End If
%>
<%
Dim rslocation
Dim rslocation_numRows

Set rslocation = Server.CreateObject("ADODB.Recordset")
rslocation.ActiveConnection = MM_sample_tracking_STRING
rslocation.Source = "SELECT Location FROM tbllocation WHERE Location <> '" + Replace(rslocation__MMColParam, "'", "''") + "'"
rslocation.CursorType = 0
rslocation.CursorLocation = 2
rslocation.LockType = 1
rslocation.Open()

rslocation_numRows = 0
%>


Reply With Quote