Dependent combo boxes & result shown in text box


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Dependent combo boxes & result shown in text box

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Posts
    1

    Question Dependent combo boxes & result shown in text box

    I'm new in MS Access & VB programming. I was trying to make dependent combo box for a while and it worked after 3-4 days research. However, the next step got me stuck to retrieving data from a certain cell in a single table (no relationship tables done) as shown in the sample table below:

    Sr..........Area.....Type.....Number.....Information
    1...........ABU..... RES..........1..........Information A1
    2...........ABU..... RES..........2..........Information A2
    . . . . .
    5...........ABU..... IND..........1..........Information A5
    6...........ABU..... IND..........2..........Information A6
    . . . . .
    10..........DXB..... RES.........1..........Information D1
    . . . . .
    13..........DXB..... IND.........1..........Information D4
    . . . . .
    . . . . .
    28..........SHJ..... IND..........3..........Information S9

    I have attached an image of my GUI done in MS Access to simplify my explanation.

    I have managed to create dependency combo lists and display unique names of three fields (Area,Type & Number) from the table. However, I couldn't get hold on the required command to display the the "Information" column corresponding to the three choices into a text box " txtInfo" as shown in the GUI Image. I want it to display whenever the user makes all combo selections & pressing the Accept button.

    A sample of the command used for combo list dependancy was:
    cboType.RowSource = "Select Distinct tblInfo.Area From tblInfo where tblInfo.Area = '" & cboArea & "' Order by tblInfo.Type;"

    I'm avoiding using relationship tables therefore please if there is any possible way to display information in the text box after selecting the choices & accepting it, please write the whole command (if possible)

    cboArea => Area Combo box
    cboType => Type Combo box
    cboNumber => Number Combo box
    txtInfo => text box
    tblInfo => table

    Thank you
    Attached Images Attached Images
    Last edited by viperor; 08-05-2006 at 06:13 AM. Reason: Table Alignment

  2. #2
    Join Date
    Apr 2008
    Posts
    1

    Smile u can try this

    U can use this code for updating the records selected from the combo box...
    here there is a student table with the fields name(varchar),usn(varchar),marks(int)...i n combo box we have taken "usn"




    cnn.Open();
    string sql = "UPDATE Student SET Name='" + TextBox1.Text +" ',Marks=" + Convert.ToInt32(TextBox2.Text) +
    "WHERE Usn LIKE '" + DropDownList1.Text + "'";
    SqlCommand cmd = new SqlCommand(sql, cnn);

    cmd.ExecuteNonQuery();
    cnn.Close();
    Response.Write("Data Updated Sucessfully");

Similar Threads

  1. Combo Box help
    By software_develo in forum .NET
    Replies: 3
    Last Post: 08-05-2006, 01:16 AM
  2. Searching records using a Combo box
    By Ernie in forum VB Classic
    Replies: 2
    Last Post: 02-04-2003, 01:12 PM
  3. Filling in text Box With Combo Select
    By Jason in forum VB Classic
    Replies: 1
    Last Post: 02-21-2002, 11:02 AM
  4. Problems with NetAddUser
    By Jeff Morgan in forum VB Classic
    Replies: 2
    Last Post: 02-13-2001, 10:49 AM
  5. Problems with NetAddUser
    By Jeff Morgan in forum VB Classic
    Replies: 0
    Last Post: 02-11-2001, 12:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center