Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-21-2013, 05:12 AM
IvanGeorgiev IvanGeorgiev is offline how to populate textbox based on combobox selection in word Windows 7 64bit how to populate textbox based on combobox selection in word Office 2007
Novice
how to populate textbox based on combobox selection in word
 
Join Date: Feb 2013
Posts: 2
IvanGeorgiev is on a distinguished road
Default how to populate textbox based on combobox selection in word

Hi,

I want to populate textbox (activex) in word based on combobox(activex) selection - filled from excel. I have a column named Koda2 in excel file named "popravila" in worksheet basisdaten, and a want when i choose a value in combobox to fill a textbox with the value from the same worksheet in column "nanosi".


ex.
koda2 nanosi

12312 45m
78429 94m
...
When I choose 12312 in combobox i want to fill automatically textbox with value 45m.

I fill combobox with that code:
Code:
Public Sub UserForm_Initialize() 
     
    Dim db As DAO.Database 
    Dim rs As DAO.Recordset 
    Dim NoOfRecords As Long 
     
    Set db = OpenDatabase("C:\Users\Ivan_Andriana\Documents\Iskra ISD\popravila\popravila.xls", False, False, "Excel 8.0;") 
    Set rs = db.OpenRecordset("SELECT * FROM Koda2") 
    With rs 
        .MoveLast 
        NoOfRecords = .RecordCount 
        .MoveFirst 
    End With 
     
    ComboBox1.ColumnCount = rs.Fields.Count 
     
    ComboBox1.Column = rs.GetRows(NoOfRecords) 
     
    rs.Close 
    db.Close 
    Set rs = Nothing 
    Set db = Nothing 
End Sub
Thanks for help

Last edited by macropod; 02-21-2013 at 07:29 PM. Reason: Added code tags & formatting
Reply With Quote
  #2  
Old 02-21-2013, 07:28 PM
macropod's Avatar
macropod macropod is offline how to populate textbox based on combobox selection in word Windows 7 64bit how to populate textbox based on combobox selection in word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Cross-posted at: http://www.vbaexpress.com/forum/showthread.php?t=45401
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184

Also, when posting code, please use the code tags. They're on the 'Go Advanced' tab.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to populate textbox based on combobox selection in word IvanGeorgiev Word 1 02-21-2013 07:32 PM
how to populate textbox based on combobox selection in word Selection of all Text for a specific page in word is spanning selection across pages ramsgarla Word VBA 9 12-05-2012 03:23 AM
how to populate textbox based on combobox selection in word Display result in textbox based on the input of another textbox scarymovie Word VBA 5 05-16-2012 07:05 PM
Macro to populate a text form field based on dropdown selection koloa Word 0 10-20-2011 11:52 AM
Textbox updating from combobox selection paxile2k Word VBA 0 10-26-2010 02:30 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:18 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft