Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    24

    Unanswered: combining two entries from a combo box into one field on a table

    I have two combo boxes, that gets its values from related tables. How do i combine the values of both combo box into a field on a table.


    Combo1=value=1

    Combo2=value=d


    tblfield=1d

    Please help....

  2. #2
    Join Date
    Mar 2004
    Posts
    33

    Re: combining two entries from a combo box into one field on a table

    Originally posted by tau
    I have two combo boxes, that gets its values from related tables. How do i combine the values of both combo box into a field on a table.


    Combo1=value=1

    Combo2=value=d


    tblfield=1d

    Please help....


    In the After Update event for Combo2 try using the following:

    [tblfield] = [Combo1] & [Combo2]

  3. #3
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346

    Re: combining two entries from a combo box into one field on a table

    Here is an example using ADO (remember to add the Microsoft ActiveX Data Objects to your database). Verify the SQL syntax however that is the technique to concatenate strings.

    Dim cn as ADODB.Connection

    Set cn = new ADODB.Connection

    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Test.mdb;Persist Security Info=False"

    cn.open

    cn.Execute "UPDATE Table SET tblfield='" Combo1.Value & Combo2.Value & "' FROM Table"

    cn.close

    set cn = nothing
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

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