I'm going MAD!, HELP PLEASE!!!

Results 1 to 3 of 3

Thread: I'm going MAD!, HELP PLEASE!!!

  1. #1
    Desperate Guest

    Default I'm going MAD!, HELP PLEASE!!!

    sql, vbscript, and/or ?...HELP!<BR><BR>I can&#039t get a handle on how this is suppose to work.<BR>I have a MS Access DB ("POLLS") containing 2 tables; streets & precincts<BR>The STREETS table containes 5 fields (1. Low # (2. High # (3. Str Name (4. City (5. pct<BR>Fields 1 & 2 contain range numbers (i.e. 4000 - 5000) 4000 being the low and 5000 being the high.<BR>The PRECINCTS table contains 5fields (1. pct (2. FacilityName (3. FacilityAdd (4. City (5.ST<BR>The 2 table are joined at the PCT fields.<BR><BR>I have a form - <BR>&#060;form action="pollingplace.htm" method="get" name="pollsform"&#062;<BR> &#060;div align="left"&#062;<BR><BR> STREET ADDRESS&#060;input name="strnmbr" size="5"&#062;<BR>&#060;input type="Text" name="strname" size="35"&#062; *NO APT # REQUIRED<BR>&#060;select name="dropdown" size="1"&#062;<BR> &#060;option selected value="0"&#062;City&#060;/option&#062;<BR> &#060;option value="AGUA"&#062;Aguanga&#060;/option&#062;<BR> &#060;option value="ANZA"&#062;Anza&#060;/option&#062;<BR> &#060;option value="BANN"&#062;Banning&#060;/option&#062;<BR> &#060;option value="BEAU"&#062;Beaumont&#060;/option&#062;<BR> &#060;option value="BLYT"&#062;Blythe&#060;/option&#062;<BR> &#060;option value="BRDM"&#062;Bermuda Dunes&#060;/option&#062;<BR> &#060;/select&#062;<BR><BR> &#060;input type="image" alt="Your Polling Place!" src="../graphics/dir/animate/homejump.gif"<BR> name="Your Polling Place" width="40" height="40"&#062; &#060;/p&#062;<BR> &#060;/div&#062;<BR>My goal is to supply the name & address of the polling place (pct_pp.facilityName) upon the voters input of their address. The first form field is for house#, the second for street name.<BR><BR>If this is at all clear to anyone as to what I am trying to do, please HELP me out with some code. I&#039M DESPERATE!!!!!!!!!!<BR><BR>Thanks in advance!<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: I'm going MAD!, HELP PLEASE!!!

    hi, there, you need a &#060;/form&#062; tag. also the action page normally is an asp page. so action="pollingplace.asp"<BR>hope this helps. ben

  3. #3
    Join Date
    Dec 1969

    Default RE: I'm going MAD!, HELP PLEASE!!!

    I answered this question last week.<BR><BR>Did I not answer you? Did you not read my answer? Did you not understand my answer? Was it somebody else taking the same course you are? Am I doing homework for two of you, now?<BR><BR>Well, since I answered once, I&#039ll do it again, though in more abbreviated fashion. Go find my previous answer if you need something longer.<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;STREETS table <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;Low Numeric<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;High Numeric<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;StrName Text<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;City Text<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;pct Numeric<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;PRECINCTS table <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;pct Numeric, primary key<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;FacilityName Text<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;FacilityAdd Text<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;City Text<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;ST Text<BR><BR>**********************<BR><BR>So, to build the SELECT, you do:<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;reqNumber = Request("strnmbr")<BR>&nbsp;&nbsp;&nbsp;&nbsp;reqN ame = Request("strname")<BR>&nbsp;&nbsp;&nbsp;&nbsp;reqC ity = Request("dropdown") &#039 a really terrible field name!<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;SQL = "SELECT Precincts.* FROM Streets, Precincts " _<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;& "WHERE Streets.StrName = &#039" & reqName & "&#039 " _<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;& "AND Streets.City = &#039" & reqCity & "&#039 " _<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;& "AND Streets.Low &#060;= " & reqNumber & " " _<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;& "AND Streets.High &#062;= " & reqNumber & " " _<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;& "AND Precincts.pct = Streets.pct"<BR><BR>Do you understand the basics of that? You first have to find *where* the user&#039s input address is in the Streets table. You do that by purposely going after the most RESTRICTIVE matches first (a really good database engine would make this step unnecessary, but with Access it&#039s a good idea to help it along). Since a match on street name probably gets you the fewest matching records in the Streets table, you do that first. Then you match on the City, thus tossing out streets of the same name in other cities. Finally, you match on the number. You ensure that the user&#039s number is somewhere in the Lot to High range. Hopefully, by this point you are down to a single matching precinct in the Streets table. So then the rest is easy: Just ask for the record in the Precincts table that has the same precinct number as that in the record you just found in the Streets table. Presto, you are done. You could use "INNER JOIN" syntax to do this query, but it is simplistic enough, and you are going after the item in the second table that matches via the primary key, so that the above syntax should work just fine.<BR><BR>Now, as I said in my other message on this topic (so *are* you doing this for some class???), all of this is nearly useless.<BR><BR>Consider the guy living at <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;715 N. Fifth Street<BR>How many possible ways could he answer your street name question?<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;N. Fifth Street <BR>Sure. But how about:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;North Fifth<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;North Fifth Street<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;Fifth<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;Fifth Street<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;N. 5th<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;N. 5th Street<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;N. 5th St<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;N. 5th St.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;5th<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;5th Street<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;5th St<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;5th St.<BR>and so many variations on that! HUMANS DO NOT DO WHAT YOU EXPECT OR WISH!<BR><BR>So I contend that you should make the list of possible streets into drop down lists, as well. Otherwise only maybe one in four people will enter the street name the same way you have it in the database.<BR><BR>It is precisely because you are not considering what your users may type in that I feel this is a homework project. And I&#039d feel guilty about helping you do homework except for the fact that *hopefully* I&#039ve made you think a bit more about the problem and *maybe* you&#039ll do a better job than just go after the "C" grade I would give you if you used my answer (even if I didn&#039t know you used somebody else&#039s answer).<BR><BR>What school is this for?<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts