I entered the flowing VBA Access 2010 code in the code (Alt-F11) window of my Access 2010 application.
Code:
Option Compare Database
Option Explicit
'Create a String varaibale named NewValList
Dim NewValList As String
'Build NewValList string in chunks.
NewValList = Chr(34) + "First item" + Chr(34) + ";"
NewValList = NewValList + Chr(34) + "Second Item" + Chr(34) + ";"
NewValList = NewValList + Chr(34) + "Third Item" + Chr(34) + ";"
NewValList = NewValList + Chr(34) + "Fourth Item" + Chr(34)
'At this point . NewValList contains...
'"First item": "Second Item" + "Third Item"" "fourth Item"
'Make new string the Row Source for value list named OpsCombo
Me!OpsCombo.RowSourceType = "Value List"
Me!OpsCombo.RowSource = NewValueList
'Set the selection to first item in drop down menu
Me!OpsCombo.Value = Me!OpsCombo.ItemData(0)
Now how do I run it? I can cut and paste it to any window I want. I guess that I should
make a subprogram out of it with Start Sub and End Sub put around it. Anyway, I got this from a tutorial and I believe it is
good with no errors. But how do I run it?
Respectfully,
Lou_Reed