Reply
 
Thread Tools Display Modes
  #1   Report Post  
Ivan_Georgiev Ivan_Georgiev is offline
Junior Member
 
Posts: 0
Default how to populate textbox based on combobox in word from excel

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:

Public Sub UserForm_Initialize()

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim rs1 As DAO.Recordset
Dim NoOfRecords As Long

Set db = OpenDatabase("C:\Users\Ivan_Andriana\Documents\Isk ra 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 Ivan_Georgiev : February 21st 13 at 01:51 PM
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate Word from Excel TheRogue! New Users 0 June 22nd 12 09:02 PM
excel and combobox question Gmann Microsoft Word Help 0 February 9th 10 05:13 PM
Entering text in one textbox and have it automatically populate ot Steven W. Microsoft Word Help 1 March 1st 09 09:46 PM
How do I populate my combobox - I know...it's been asked. lkgoldie New Users 5 March 15th 08 08:58 AM
combobox combine with textbox hein Microsoft Word Help 1 February 14th 05 04:58 PM


All times are GMT +1. The time now is 01:58 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"