David McAfee
DMcAfee at haascnc.com
Tue Mar 25 16:57:00 CST 2003
Jeffrey, if a stored procedure (SPROC) is what populating the combo box (and you are in an ADP) then all you have to do is place the following in the combo box's OnEnter event: Me.YourComboBox.RowSource = "EXEC YourSprocNameHere '" & YourParameter & "'" if you have no parameter to send to the SPROC, then it is even easier: Me.YourComboBox.RowSource = "EXEC YourSprocNameHere" or if it simply a view then just place the view's name in the combo's recordsource filed as you would a query. If you are not using an ADP, and instead are using an MDB, you should be able to simply put the name of the query as the rowsource for you combo Doesn't your query/sproc return the result set that you want for your combo? HTH David -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of jeffrey.demulling at usbank.com Sent: Tuesday, March 25, 2003 1:36 PM To: accessd at databaseadvisors.com Subject: [AccessD] Help populating a drop down box in A2K Hello all, I have the following code: Public Sub FillIssuer() Dim con As New ADODB.Connection Dim RS As New ADODB.Recordset Dim cmdText As String Dim strList As String DoCmd.SetWarnings False DoCmd.OpenQuery "qryDeleteIssuers" DoCmd.SetWarnings True strList = "" con = setconnection con.Open cmdText = "SELECT tblIssuers.[Name], tblIssuers.[Number], tblIssuers.[Display] From tblIssuers ORDER BY tblIssuers.[Name]" RS.Open cmdText, con RS.MoveFirst While Not RS.EOF strList = "INSERT INTO tblDisplayIssuers ([Number], Name, Display) Values (" & RS("Number") & ", '" & RS("Name") & "', " & RS("Display") & ");" DoCmd.RunSQL (strList) RS.MoveNext Wend con.Close End Sub What I want to do is instead of walking through the recordset one record at a time, I would like to do one single Insert command. The data is being pulled from a SQL server and should be put into a local db table. I am using the returned data in a drop-down box. Any help or suggestions would be greatly appreciated. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030325/38c20b14/attachment-0001.html>