I have a problem that's driving me insane.
I am developing a web form. Right now, it has just two fields, though it will have much more once I can solve this rather vexing problem! The first field is hidden, with a predetermined value (field name/id is "Organization" and it's predetermined value is "Bloomfield Garfield Corp"), and the second is a simple text field called "FirstName". I am querying an Access Database using ASP powered by VBScript and of course SQL.
Here is the problem: if the user leaves the FirstName field blank, no results are returned. This is decidedly NOT the desired outcome! What needs to happen is, if the user leaves the FirstName field blank, the results page needs to show ALL the FirstNames in the DB associated with the predetermined org (Bloomfield Garfiled Corp). Then, if a user types in a first name, only results with that first name are shown, if any (this works fine!)
I have searched and searched and searched news groups and tech support groups, etc., and almost without fail, they say I need to use % as a default value for the FirstName field. I have done this in both the HTML form (ie, <input name="FirstName" type="text" id="FirstName" value="%" /> ), and even more importantly, I have done so in the SQL (see below) but it simply refuses to work. Can anyone help me? I am about to go certifiably mad! My wife won't go near me!
Thanks in advance for any help. My SQL code is below, as well. I am generating most of the code using Dreamweaver 8, though my SQL statements are custom written. I am pretty sure that's the problem, as I am somewhat code-challenged, as you have probably already guessed!! I am viewing the web pages in latest IE on a machine running Windows XP. Web server I am publishing to is Microsost box running IIS.
Thanks again in advance for any help!
Here is the SQL:
Result__MMColParam = "%"
tName") <> "") Then
Result__MMColParam = Request.QueryString("First
Result__Org = "%"
<> "") Then
Result__Org = Request.QueryString("Organ
Set Result = Server.CreateObject("ADODB
Result.ActiveConnection = MM_atlast_STRING
Result.Source = "SELECT * FROM EmployementData WHERE Organization = '" + Replace(Result__Org, "'", "''") + "' AND FirstName = '" + Replace(Result__MMColParam
, "'", "''") + "'"
Result.CursorType = 0
Result.CursorLocation = 2
Result.LockType = 1
Result_numRows = 0
Listing__MMColParam = "Bloomfield Garfield Corp"
If (Request("MM_EmptyValue") <> "") Then
Listing__MMColParam = Request("MM_EmptyValue")
Set Listing = Server.CreateObject("ADODB
Listing.ActiveConnection = MM_atlast_STRING
Listing.Source = "SELECT * FROM EmployementData WHERE Organization = '" + Replace(Listing__MMColPara
m, "'", "''") + "'"
Listing.CursorType = 0
Listing.CursorLocation = 2
Listing.LockType = 1
Listing_numRows = 0
Repeat1__numRows = 10
Repeat1__index = 0
Result_numRows = Result_numRows + Repeat1__numRows
If you want to view and/or test the actual web pages, they are here, but you will need username and pass;
If you want to see a successful query, search for "Jim" "Jimi" or "Janis". Back-end DB is small, and with dummy data, until I can iron out this issue!