Valuelist in Combobox

D

dhstein

I'm trying to set up a combobox with a list of my queries. I have code that
creates a string of each query separated by vbCRLF. I use this function as
the control source in my combobox and specify to use a valuelist. This
returns the string as a single line in the combo box, which is obviously not
what I want. Is it possible to use this method to populate the combobox? Do
I need to change the delimiter? (I tried ";") Any suggestions are
appreciated.


Public Function GetQueryList() As String
' List all the queries
Dim QryCount As Integer
Dim QryName As String
Dim QryPrefix As String

GetQueryList = " " & vbCrLf
For QryCount = 0 To CurrentDb.QueryDefs.Count - 1

QryName = CurrentDb.QueryDefs(QryCount).Name
QryPrefix = Left(QryName, 3)
If QryPrefix = "qry" Then

GetQueryList = GetQueryList & QryName & vbCrLf

End If
Next

End Function
 
D

Dale Fye

How about just using the lists AddItem method. Something like:

For qryCount = 0 to Currentdb.QueryDefs.Count - 1

me.lst_ListControlName.AddItem currentdb.querydefs(qryCount).Name

Next

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 

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