Results 1 to 4 of 4
  1. #1
    white_flag is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    26

    populate textboxes via comboboxes selection

    Hello

    I have an combobox that will have 10 columns but only one column will be displayed. I like to know how to put info from colum(3)4 etc ..in an text.box(3),4 etc. I try this but without success:



    Code:
    Private Sub Combo3_AfterUpdate()
        'Me.Text7.ControlSource = Me.Combo3.Column(2) - not working
    End Sub
    I have this code:
    Code:
    Option Compare Database
    Private Sub Combo3_AfterUpdate()
        'Me.Text7.ControlSource = Me.Combo3.Column(2) - not working
    End Sub
    
    Private Sub Combo3_Change()
        Me.Image0.Picture = Me.Combo3.Column(2)
    End Sub
    
    Private Sub Form_Load()
        Me.Combo3.RowSource = "SELECT imagineID, titlu, '" & Application.CurrentProject.Path & "\' & " & "[cale_imagine] AS Expr1 FROM imagini ORDER BY [titlu]"
    End Sub
    
    Private Sub Text7_BeforeUpdate(Cancel As Integer)
        Me.Text7.Text = Me.Combo3.Column(2)
    End Sub

  2. #2
    white_flag is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    26
    I putted like this (use DLookup()):

    Code:
    Private Sub Combo3_Change()
        Dim nume As Variant
        Me.Image0.Picture = Me.Combo3.Column(2)
        Me.Combo3.SetFocus
        Me.Text7.SetFocus
    '[table] "column.name"
        nume = DLookup("[titlu]", "imagini")
        Me.Text7.Text = nume
    End Sub
    it is working. The question: it is correct like this?

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You do not need to move the focus if you use the .Value (default) property. So:
    Me.Text7.Value = nume
    ...or
    Me.Text7 = nume
    ...would work without changing the focus.

  4. #4
    white_flag is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    26
    thx mate. it is working

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 07-20-2015, 10:55 AM
  2. Replies: 0
    Last Post: 06-29-2011, 01:04 PM
  3. Populate a field based on combobox selection
    By rscott7706 in forum Access
    Replies: 5
    Last Post: 06-02-2011, 03:18 PM
  4. Replies: 0
    Last Post: 12-02-2010, 11:59 AM
  5. subform comboboxes/Textboxes
    By terryvanduzee in forum Forms
    Replies: 2
    Last Post: 11-19-2009, 07:41 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
  •  
Other Forums: Microsoft Office Forums