Results 1 to 3 of 3

Thread: Criteria combos

  1. #1
    2 Star Lounger
    Join Date
    May 2003
    Location
    Perth, Western Australia, Australia
    Posts
    150
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Criteria combos

    Hi everyone,
    I've been having this problem, and I dont know how to communicate it effectivelty, so I've made an image of what I'm seeking. I've placed the image on the web
    http://www.w-projects.net/sumweight.jpg

    Basically, it speaks for itself, Where it says "Select Module No", depending on the "GetMod" that is selected, I want the accompanying combo boxs to fill the data that relates to the Module No.
    And depending also on the Size, Material Grade and part that is selected, the user pressing "Total Weight" will give him/her the result of the total weight from the table based on the criterias selected.
    Any advice/help would be soooooo much appreciated on this.
    Thankyou in advance.

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Criteria combos

    Hi Mark,

    You can build a simple select statement from your combo boxes to give you a total. Like this:

    strSQL = "Select SUM(Weight) AS SumOfWeight FROM tblmodSheets WHERE GetMod=" & Request.Form("GetMod") _
    & " AND Size=" & Request.Form("Size") _
    & " AND MatlGrade=" & Request.Form("MatlGrade") _
    & " AND Part=" & Request.Form("Part")

    Set this select statement as the source of a recordset, then assign the SumOfWeight to the text field (as you have in your diagram):

    Set rst = Server.CreateObject("ADODB.Recordset")
    rst.Open strSQL, cnnYOURCONNECTIONSTRINGHERE

    %>
    < input type=text value=<%=rst("SumOfWeight")%>>

    One thing you should keep in mind is whether you will require all 4 boxes to be filled in. If you still want to show a total from less than 4 fields, you'll need to dynamically adjust your SQL String (using IF--THEN statements) to leave out the non-selected items.

    Hope this helps!

  3. #3
    2 Star Lounger
    Join Date
    May 2003
    Location
    Perth, Western Australia, Australia
    Posts
    150
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Criteria combos

    Thanks Mark, that did help. Also came accross similar examples on the net. Problem Solved [img]/forums/images/smilies/smile.gif[/img]

Posting Permissions

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