[AccessD] Help populating a drop down box in A2K

jeffrey.demulling at usbank.com jeffrey.demulling at usbank.com
Wed Mar 26 15:47:23 CST 2003


David,

Your message made me think and I have gone from an MDB to an ADP.  Much 
easier to deal with.

Thanks for the help.




"David McAfee" <DMcAfee at haascnc.com>
Sent by: accessd-bounces at databaseadvisors.com
03/25/2003 04:57 PM
Please respond to accessd

 
        To:     "'accessd at databaseadvisors.com'" <accessd at databaseadvisors.com>
        cc:     "'jeffrey.demulling at usbank.com'" <jeffrey.demulling at usbank.com>
        Subject:        RE: [AccessD] Help populating a drop down box in A2K


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._______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030326/841a459c/attachment-0001.html>


More information about the AccessD mailing list