Results 1 to 2 of 2

Thread: Combo dropdown to selct from Access table

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Location
    Littlehampton, W Sussex GB
    Posts
    203

    Post

    I am entering data on a from to update an access database and for some fields I need to use a drop-down select from a different access table(eg area, industry) Can i do this with a combo? Is it possible to populate a combo text with data from an access table? Help please!!

  2. #2
    Addicted Member
    Join Date
    Apr 1999
    Location
    Freeport
    Posts
    204

    Post

    May be this will help. Use a DBCombo box and bound it to Data1 control. Insert some textbox and bound them to Data2. I thinking you know how to use Data Control. Then place a button and apply this code.
    Dim sql As String
    Dim last As String
    Dim db As Database
    Dim dbr As Recordset
    'I used last name because that is what my
    'DBCombo box is populated with
    last = DBCombo1.Text
    sql = "select * from " & "member where lastname = '" & last & "';"
    'Use this pwd if you database is password
    'protected if not then just ("Database 'Path").
    Set db = OpenDatabase _
    ("Database Path", False, False, "MS Access;pwd=Password of Database")
    Set dbs = db.OpenRecordset(sql)
    Do Until dbs.EOF
    Data2.Refresh
    Data2.RecordSource = sql
    dbs.MoveNext
    Loop
    Data2.Refresh

Posting Permissions

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



Click Here to Expand Forum to Full Width