Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Value of Access Dropdown

Status
Not open for further replies.

Geodon7

Technical User
Jun 24, 2002
27
0
0
US
This is a very simple question, but I don't know VB well enough to know how to do it. I have a dropdown box, and I want to know what the value of it is being stored as so I can know if I am referring to it correctly at a later point in my code. This is the code I have:

Code:
Dim test As String
    test = ProgramNameDrop.Value
    Debug.Print test

My problem is I don't know how to output code to a window where I can see the value. Additionally, I don't know where to place this code within my VB file. I also do not know if I have coded this correctly.

Thanks for helping out a beginner!
G
 
If I understand you correctly you want to be able to see the selected value from the combo box named ProgramNameDrop.

Dim test As String
test = ProgramNameDrop.text
msgbox test

This places the selected value into your variable and then displays it with a message box. To display it in a text box use,
Text1 = ProgramNameDrop.text Thanks and Good Luck!

zemp
 
I'm not sure what it is you want but if in your dropdown box you are displaying text and assigning an alternat value such as the display says ITEM1 but the value of that when selected is 1 then you need to use

test = ProgramNameDrop.ItemData(ProgramNameDrop.ListIndex)

this will give you the the value of the currently selected item, additionally you can use

msgbox = text

to display the value in a msgbox window

Hope this helps ... good luck
 
robctech is correct in the alternative method of assigning the value to a variable , but watch the message box funtion.
It should read

msgbox test
Thanks and Good Luck!

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top