cascading listboxes

I

iris

I have a userform in word with 1 listbox and 3 textboxes.

the database is an access database with 7 columns.

I am initializing the listbox with 7 columnbound columns.

this is my code:

Private Sub UserForm_Initialize()
On Error Resume Next

Dim dbDatabase As Database
Dim rsd As Recordset
Dim d As Integer
Set dbDatabase = OpenDatabase("C:\nihul.mdb")
Set rsd = dbDatabase.OpenRecordset("SELECT * FROM expressions ORDER BY
heb;", dbOpenSnapshot)

ListBox1.Clear
d = 0
With rsd
Do Until .EOF
ListBox1.AddItem (d)
ListBox1.ColumnCount = 3
ListBox1.BoundColumn = 7
ListBox1.ColumnWidths = "4 in;4 in;0.5 in;"
ListBox1.Column(6, d) = ![hebrt]
ListBox1.Column(0, d) = ![heb]
ListBox1.Column(1, d) = ![eng]
ListBox1.Column(2, d) = ![engRT]
.MoveNext
d = d + 1
Loop
End With

rsd.Close
dbDatabase.Close
Set rsd = Nothing
Set dbDatabase = Nothing
End Sub

after initializing the list box, I want to click on an item in the listbox
and see the coloumnbound data from the database in the 3 textboxes (each
column in an other textbox).

Thank you in advance for your help!

Iris
 
D

Doug Robbins - Word MVP

I posted this in response to your earlier message

Look at the two examples of loading a listbox from Access on the following
page of Greg's website:

http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm

Note, if you set the .ColumnCount to 3, you cannot then set the .BoundColumn
to 7



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
I

iris

Hi Doug

Thank you for your reply.

I saw Gregs example - but I'm having trouble to apply it ... Greg i
Using an array and I'm using a database... I'm having trouble to conver
Gregs source to mine....

I will be gratefull if you can help me with that....

Thank you

Iris
I posted this in response to your earlier message

Look at the two examples of loading a listbox from Access on th
following
page of Greg's website:

'Populate UserForm ListBox
(http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm)

Note, if you set the .ColumnCount to 3, you cannot then set th
.BoundColumn
to 7



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
iris said:
I have a userform in word with 1 listbox and 3 textboxes.

the database is an access database with 7 columns.

I am initializing the listbox with 7 columnbound columns.

this is my code:

Private Sub UserForm_Initialize()
On Error Resume Next

Dim dbDatabase As Database
Dim rsd As Recordset
Dim d As Integer
Set dbDatabase = OpenDatabase("C:\nihul.mdb")
Set rsd = dbDatabase.OpenRecordset("SELECT * FROM expressions ORDE BY
heb;", dbOpenSnapshot)

ListBox1.Clear
d = 0
With rsd
Do Until .EOF
ListBox1.AddItem (d)
ListBox1.ColumnCount = 3
ListBox1.BoundColumn = 7
ListBox1.ColumnWidths = "4 in;4 in;0.5 in;"
ListBox1.Column(6, d) = ![hebrt]
ListBox1.Column(0, d) = ![heb]
ListBox1.Column(1, d) = ![eng]
ListBox1.Column(2, d) = ![engRT]
.MoveNext
d = d + 1
Loop
End With

rsd.Close
dbDatabase.Close
Set rsd = Nothing
Set dbDatabase = Nothing
End Sub

after initializing the list box, I want to click on an item in th listbox
and see the coloumnbound data from the database in the 3 textboxe (each
column in an other textbox).

Thank you in advance for your help!

Iris
 
D

Doug Robbins - Word MVP

ACCESS IS A DATABASE

Look at the two examples of loading a listbox from Access on the following
page of Greg's website:

http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm

Note, if you set the .ColumnCount to 3, you cannot then set the .BoundColumn
to 7


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
iris said:
Hi Doug

Thank you for your reply.

I saw Gregs example - but I'm having trouble to apply it ... Greg is
Using an array and I'm using a database... I'm having trouble to convert
Gregs source to mine....

I will be gratefull if you can help me with that....

Thank you

Iris
I posted this in response to your earlier message

Look at the two examples of loading a listbox from Access on the
following
page of Greg's website:

'Populate UserForm ListBox'
(http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm)

Note, if you set the .ColumnCount to 3, you cannot then set the
.BoundColumn
to 7



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
iris said:
I have a userform in word with 1 listbox and 3 textboxes.

the database is an access database with 7 columns.

I am initializing the listbox with 7 columnbound columns.

this is my code:

Private Sub UserForm_Initialize()
On Error Resume Next

Dim dbDatabase As Database
Dim rsd As Recordset
Dim d As Integer
Set dbDatabase = OpenDatabase("C:\nihul.mdb")
Set rsd = dbDatabase.OpenRecordset("SELECT * FROM expressions ORDER BY
heb;", dbOpenSnapshot)

ListBox1.Clear
d = 0
With rsd
Do Until .EOF
ListBox1.AddItem (d)
ListBox1.ColumnCount = 3
ListBox1.BoundColumn = 7
ListBox1.ColumnWidths = "4 in;4 in;0.5 in;"
ListBox1.Column(6, d) = ![hebrt]
ListBox1.Column(0, d) = ![heb]
ListBox1.Column(1, d) = ![eng]
ListBox1.Column(2, d) = ![engRT]
.MoveNext
d = d + 1
Loop
End With

rsd.Close
dbDatabase.Close
Set rsd = Nothing
Set dbDatabase = Nothing
End Sub

after initializing the list box, I want to click on an item in the listbox
and see the coloumnbound data from the database in the 3 textboxes (each
column in an other textbox).

Thank you in advance for your help!

Iris
 
I

iris

I'll try it.

Thank you for your help!

Iris

ACCESS IS A DATABASE

Look at the two examples of loading a listbox from Access on the
following
page of Greg's website:

'Populate UserForm ListBox'
(http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm)

Note, if you set the .ColumnCount to 3, you cannot then set the
.BoundColumn
to 7


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
iris said:
Hi Doug

Thank you for your reply.

I saw Gregs example - but I'm having trouble to apply it ... Greg is
Using an array and I'm using a database... I'm having trouble to convert
Gregs source to mine....

I will be gratefull if you can help me with that....

Thank you

Iris
I posted this in response to your earlier message

Look at the two examples of loading a listbox from Access on the
following
page of Greg's website:

'Populate UserForm ListBox'
('Populate UserForm ListBox' (http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm))

Note, if you set the .ColumnCount to 3, you cannot then set the
.BoundColumn
to 7



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
I have a userform in word with 1 listbox and 3 textboxes.

the database is an access database with 7 columns.

I am initializing the listbox with 7 columnbound columns.

this is my code:

Private Sub UserForm_Initialize()
On Error Resume Next

Dim dbDatabase As Database
Dim rsd As Recordset
Dim d As Integer
Set dbDatabase = OpenDatabase("C:\nihul.mdb")
Set rsd = dbDatabase.OpenRecordset("SELECT * FROM expressions ORDER
BY
heb;", dbOpenSnapshot)

ListBox1.Clear
d = 0
With rsd
Do Until .EOF
ListBox1.AddItem (d)
ListBox1.ColumnCount = 3
ListBox1.BoundColumn = 7
ListBox1.ColumnWidths = "4 in;4 in;0.5 in;"
ListBox1.Column(6, d) = ![hebrt]
ListBox1.Column(0, d) = ![heb]
ListBox1.Column(1, d) = ![eng]
ListBox1.Column(2, d) = ![engRT]
.MoveNext
d = d + 1
Loop
End With

rsd.Close
dbDatabase.Close
Set rsd = Nothing
Set dbDatabase = Nothing
End Sub

after initializing the list box, I want to click on an item in the
listbox
and see the coloumnbound data from the database in the 3 textboxes
(each
column in an other textbox).

Thank you in advance for your help!

Iris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top