Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

New Recordset for each state?

Posted 08 Apr 2002 04:07:56
1
has voted
08 Apr 2002 04:07:56 carrie spence posted:
HI all

Working on my very first ultradev page, (eek) and for starters I am trying to show a single page, which features each state and all the members and town therein. Some states have one member, some have 100, and the boss wants them all on one page...as an HTML page alone, the text is 45Kb. My question is, do I set it up with a different recordset for each state? So, there is a California Recordset, which displays everyone in CA, their name and their town? Or is there another way to do it? I've gotten it to display making a different recordset for each state, but just wondering if I am going the long way about it..
Appreciate the input!
Carrie

Replies

Replied 08 Apr 2002 05:40:57
08 Apr 2002 05:40:57 Owen Eastwick replied:
You should create 1 recordset which then selects the relevant info according to the state selected.

Something like:

varState = Replace(Request("InputFieldName", "'", "''"

RecordsetName.Source = "SELECT * FROM TableName WHERE StateFieldName LIKE '%" & varState & "%'"

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 08 Apr 2002 15:16:17
08 Apr 2002 15:16:17 carrie spence replied:
Hi Owen and thanks!
I am not doing a search on this page....I am just displaying each member according to state...(It's a reallllly long page)...so the page says something like this
California - 93
last name, first name town
last name, first name town
etc.
Connecticut - 1
last name, first name town
but it is all on one page, and non-searchable....
I will also be making an admin page to go with it, so the boss can update the members, deleting them or adding new ones according to the state they are in...
does that explain it a bit better?
Carrie
Replied 08 Apr 2002 15:58:22
08 Apr 2002 15:58:22 Owen Eastwick replied:
Have you tried GROUP BY?

SELECT StateField, Field1, Field2, Field3 GROUP BY StateField, Field1, Field2, Field3

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 09 Apr 2002 05:30:30
09 Apr 2002 05:30:30 carrie spence replied:
Hello again...
=)
Could you explain the GROUP BY statement a bit? Sorry to be a pest, but it's my very first page.....they don't cover that in the tutorial...!

carrie
Replied 09 Apr 2002 16:54:46
09 Apr 2002 16:54:46 Owen Eastwick replied:
GROUP BY is similar to SORT BY, but will group things together under the first field selected so if you grouped by state something like:

SELECT Lastname, Firstname, State GROUP BY State, LastName, Firstname

You would produce a list something like:

Benson - Carl - Alabame
Johnson - Fred - Alabama
Smith - Zack - Alabama
Anderson - Burt - Georgia
Benjamin - Andy - Georgia
Frederick - Steven - Texas
Peterson - Mike - Texas

Set up a recordset, give it a try and see if it's any use.

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo

Reply to this topic