By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,948 Members | 852 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

Listbox to table help

P: n/a
I have a list box based on a query. I set the row source in vba with a
dynamic string.

I have a combo box at the top of the form that selects a unit number
(formatted as text). This unit number is the PK for the main table.
The listbox referenced above is used to create a rework report for the
selected unit.

What I need to do is grab the unit number from the combo box, (which
we designate as [RMA #]- I know it's screwy and not right- not my
fault) and each item in the list box and build an update query out of
them for a table.

The table has the unit number as the PK and is also the FK to the main
table.

So basically I need a string that looks like this and makes a unique
record for each item in the list box:

D0809100 (this is the unit number), Test Unit (one of the rows in the
list box)
D0809100, Shine Unit
D0809100, Ship Unit
etc., etc.

Hopefully this is as clear as mud. Thanks in advance for the help.

Troy
Sep 18 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
tr******@comcast.net wrote:
I have a list box based on a query. I set the row source in vba with a
dynamic string.

I have a combo box at the top of the form that selects a unit number
(formatted as text). This unit number is the PK for the main table.
The listbox referenced above is used to create a rework report for the
selected unit.

What I need to do is grab the unit number from the combo box, (which
we designate as [RMA #]- I know it's screwy and not right- not my
fault) and each item in the list box and build an update query out of
them for a table.

The table has the unit number as the PK and is also the FK to the main
table.

So basically I need a string that looks like this and makes a unique
record for each item in the list box:

D0809100 (this is the unit number), Test Unit (one of the rows in the
list box)
D0809100, Shine Unit
D0809100, Ship Unit
etc., etc.

Hopefully this is as clear as mud. Thanks in advance for the help.

Troy
This might give you an idea on how to proceed. You can use Column() to
determine which column of a listbox/combobox to use. The first element
of a combo/listbox is 0. If you have ColumnHeadings set to True then
start at element 1.

Private Sub Command2_Click()
Dim intFor As Integer
Dim strUnit As String
strUnit = "D0809100"
For intFor = 0 To Me.List0.ListCount - 1
Debug.Print strUnit & ", " & Me.List0.Column(0, intFor)
Next

End Sub
Sep 18 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.