473,320 Members | 2,000 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

to display record of selected person by listbox.....

I am retiriveing some names from on database by some conditions....that names are being displayed in the listbox..........my question is if i select a name that person details should be displayed in the same form..........that person's name and other details are stored in same table..........
Plz help with code.........

My code is as follows.........
Expand|Select|Wrap|Line Numbers
  1. <%@ Language = VBScript%>
  2. <% Response.Buffer = True 
  3.  
  4. %>
  5.  
  6. <html>
  7. <head>
  8. <title>PERSONAL DETAILS</title>
  9. </head>
  10. <body>
  11.  
  12. <%
  13.     Dim da
  14.         da = date()
  15.     Dim rs
  16.         Set rs = Server.CreateObject ("ADODB.Recordset")
  17.         rs.Open "details", "DSN=Personal"
  18.  
  19.             Dim yy
  20.             Dim mm
  21.  
  22.             dim age, caste, rscaste, ageto, gender
  23.             age =  Request.Form ("D1")  '( Taken from another form  in      another asp file)
  24.             caste = Request.Form ("D2")
  25.             ageto = Request.Form ("D3")
  26.             gender = Request.Form ("R1")
  27.             a = cint (age)
  28.             b = cint (ageto) %>
  29.  
  30.            <form method="POST" action="--WEBBOT-SELF--">
  31.   <!--webbot bot="SaveResults" u-file="fpweb:///_private/form_results.csv" s-format="TEXT/CSV" s-label-fields="TRUE" --><p>
  32.   Name&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp; <select size="1" name="D1" size = "20">
  33.             <%   While Not rs.EOF
  34.  
  35.                 ' FINDING AGE
  36.  
  37.                   mm = DateDiff("m", rs("DOB"), da)
  38.                   if mm >= 12 then
  39.                     yy = cint(mm/12)
  40.                   end if 
  41.  
  42.                   ' Selecting records by age
  43.                for i = age to ageto 
  44.                  rscaste = rs("Caste") 
  45.                  if yy = i then 
  46.                    ' Selecting records by caste
  47.                    if caste = rscaste then
  48.                     ' Selecting records by Gender
  49.                      if not rs("Gender") = gender then
  50.  
  51.                  %>
  52.  
  53.   <option value = "<%=rs("Name")%>"><%=rs("Name")%></option>
  54.    <%           
  55.                 end if 
  56.                 end if  
  57.                 end if
  58.                  next
  59.  
  60.                  rs.MoveNext 
  61.                   Wend %></select></form>
  62.  
  63.  
  64.  
  65.  
  66.                   <% 
  67.  
  68.                    rs.Close
  69.              Set rs = Nothing
  70. %>
  71.  
  72. </body>
  73. </html>
Mar 17 '10 #1
2 2491
I am retiriveing some names from on database by some conditions....that names are being displayed in the listbox..........my question is if i select a name that person details should be displayed in the same form..........that person's name and other details are stored in same table..........
Plz help with code.........

My code is as follows.........
Expand|Select|Wrap|Line Numbers
  1. <%@ Language = VBScript%>
  2. <% Response.Buffer = True 
  3.  
  4. %>
  5.  
  6. <html>
  7. <head>
  8. <title>PERSONAL DETAILS</title>
  9. </head>
  10. <body>
  11.  
  12. <%
  13.     Dim da
  14.         da = date()
  15.     Dim rs
  16.         Set rs = Server.CreateObject ("ADODB.Recordset")
  17.         rs.Open "details", "DSN=Personal"
  18.  
  19.             Dim yy
  20.             Dim mm
  21.  
  22.             dim age, caste, rscaste, ageto, gender
  23.             age =  Request.Form ("D1")  '( Taken from another form  in      another asp file)
  24.             caste = Request.Form ("D2")
  25.             ageto = Request.Form ("D3")
  26.             gender = Request.Form ("R1")
  27.             a = cint (age)
  28.             b = cint (ageto) %>
  29.  
  30.            <form method="POST" action="--WEBBOT-SELF--">
  31.   <!--webbot bot="SaveResults" u-file="fpweb:///_private/form_results.csv" s-format="TEXT/CSV" s-label-fields="TRUE" --><p>
  32.   Name&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp; <select size="1" name="D1" size = "20">
  33.             <%   While Not rs.EOF
  34.  
  35.                 ' FINDING AGE
  36.  
  37.                   mm = DateDiff("m", rs("DOB"), da)
  38.                   if mm >= 12 then
  39.                     yy = cint(mm/12)
  40.                   end if 
  41.  
  42.                   ' Selecting records by age
  43.                for i = age to ageto 
  44.                  rscaste = rs("Caste") 
  45.                  if yy = i then 
  46.                    ' Selecting records by caste
  47.                    if caste = rscaste then
  48.                     ' Selecting records by Gender
  49.                      if not rs("Gender") = gender then
  50.  
  51.                  %>
  52.  
  53.   <option value = "<%=rs("Name")%>"><%=rs("Name")%></option>
  54.    <%           
  55.                 end if 
  56.                 end if  
  57.                 end if
  58.                  next
  59.  
  60.                  rs.MoveNext 
  61.                   Wend %></select></form>
  62.  
  63.  
  64.  
  65.  
  66.                   <% 
  67.  
  68.                    rs.Close
  69.              Set rs = Nothing
  70. %>
  71.  
  72. </body>
  73. </html>
Mar 17 '10 #2
jhardman
3,406 Expert 2GB
if using ASP, you are going to have to submit the form, pull up the data, and redisplay the form.

Jared
Mar 25 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: ChrisR | last post by:
Hi guys My app is a simple Main form with a few Subforms that are not linked, and a few pop forms. Problem is: I have a pop form with a Listbox with a list of records related to the...
1
by: Geir Baardsen | last post by:
Hi! On frmItems I have a two listboxes. The first, lstAllCategories, is loaded with data from tblCategory when frmItems open. When user click lstAllCategories, the lstSelectedItems will show all...
18
by: Alpha | last post by:
Hi, I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a listbox that I have binded to a dataset table, "source" which has 3 columns. I would like to display 2 of those...
0
by: Kaur | last post by:
Hi, I am having problem trying to go to same record when I close 3rd form. I have a form called frmDepartment. This form has a list box that displays all the departments. Clicking on one of the...
1
by: rsbutterfly16 via AccessMonster.com | last post by:
hi guys i have form with a listbox . The listbox is coming from a query that gets all passengers(column 1 in listbox) and destinations(column 3) . so you have repeting rows of passengers since...
6
by: MarkoBBC | last post by:
Hi everyone, First a brief description of my form: I have a subform within a main form. In my subform, I have a listbox displaying address information by firm name. A user first has to select a...
7
by: brewer95 | last post by:
I use a form to enter data into a table. The user then has the opportunity to recall the data in the form based on a search to review and update the info. For example, on my menu there is a combo...
2
by: remya1000 | last post by:
i'm using VB.NET. i have a table names "EMP". this table contain employee details like Index, empID, First name, Last name, address, phone number etc. while page loads, i need to display Last...
21
by: postman | last post by:
I have a subform which is bound to a query which will display records using an ID# supplied from a listbox in the parent form. That same subform is also used to create new records using the...
1
by: angelicdevil | last post by:
i have listbox 1 which displays status , based on selection of status listbox 2 displays usernames. and based on username selected the textbox displays the email id. its working fine till...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.