I'm new to the group...

Can MS be programmed to present a list of words for the user to choose from? A cursory search of the online manual shows me possibly.. with the Dialog ListBox option?
TIA
Chris
Moderators: JRL, Dorian (MJT support)
Hi, Bob.bob hansen wrote:I will bet the answer is YES, but can you be more explicit with an example of what you are trying to do?
=======================================
VBSTART
Function GetCustomerName(CustID)
Dim SQLString
set MyDB = CreateObject("ADODB.Connection")
MyDB.Open "Northwind"
SQLString = "select * from Customers where CustomerID = '" & CustID & "'"
set rsCustomers = MyDB.Execute(SQLString)
If Not rsCustomers.EOF then
GetCustomerName = rsCustomers.Fields("CompanyName")
Else
GetCustomerName = "Not Found"
End if
MyDB.Close
End Function
Sub ChangeName(CustID,NewName)
Dim SQLString
set MyDB = CreateObject("ADODB.Connection")
MyDB.Open "Northwind"
SQLString = "Update Customers Set CompanyName = '" & NewName & "' Where (CustomerID = '" & CustID & "')"
set rsCustomers = MyDB.Execute(SQLString)
MyDB.Close
End Sub
VBEND
Input>CustID,Enter Customer ID:
VBEval>GetCustomerName("%CustID%"),CustName
MessageModal>The Customer Name Is : %CRLF% %CRLF% %CustName%
Input>NewName,Enter New Name:,CustName
VBRun>ChangeName,%CustID%,%NewName%