Combo boxes

G

Guest

I have two combo boxes in a form. They both have a different table tied to
it as a row source. The combo box has two columns, one is a text field and
the other is a number field. I would like to create a text box that would
add up the number field once it's selected. How would I do that? Thanks
 
D

Damon Heron

Why are u telling us about the second combobox? What is its role in this?
Anyway, depending on what column your number field is that you want to add,
(lets say its column 1 -remember columns are zero-based) then the textbox
would show the results after a selection is made in the combobox, like this:
Option Compare Database
Option Explicit
Dim ct As Single ' declare this at the module level

Private Sub Combo0_AfterUpdate()
ct = ct + Combo0.Column(1)
Me.Text2.Value = ct
End Sub

Damon
 

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