0

I have made a currency converter which converts a made up currency to UK Sterling. I have made a converter on my 1st form and on my 2nd form I need to add import duties. There are 2 import duties...

1) Air Cargo: 16.5% of Sterling price
2) Shipping: 11.5% of Sterling price

I need to multiply the the label which shows the amount of UK Sterling on form 2 by either Air Cargo or Shipping depending on which one the user chooses but I have no idea how to code up a combo box as I have never used one before on Visual Basic. Please help!

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by StephNicolaou
0

First you have to drag and drop the combo box into the form. Then, under the Form Load event in the Code Builder, you call the two options, I'm assuming from a database, using the RowSource method and SQL:

Me.ComboBox.RowSource = "SELECT * FROM [Duties] IN '" & DatabasePath & "' "
Me.Requery

If you are not using a database, just write them in yourself:

Me.ComboBox.RowSource = "Duty1" & ";" & "Duty2"
or Me.ComboBox.RowSource = 1 & ";" & 2

To get the selected value, just use the .Value method:

variable = Me![Combobox].Value 
or variable = Me.Combobox

You can replace Me![Combobox] to [OtherFormName]![Combobox].Value if you are getting it from another form.

Hope that helps :)

Edited by StephNicolaou: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.