Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO with Current/Insert/Update events

Status
Not open for further replies.

dnfrantum

Programmer
Oct 23, 2001
175
US
I am using the following ADO to get a ComboBox to populate and it works, but I have to use the drop down to see any of the addresses.

What I am trying to do is:

a. On current record return the value of Address_ID_1
b. On Insert or Update, provide the entire list

Code:
Private Sub Address_Selection()

    Dim cnn As New ADODB.Connection

    Dim rs As New ADODB.Recordset

    Dim cmd As New ADODB.Command

    
    Set cnn = CurrentProject.AccessConnection

    

    With cmd

        .ActiveConnection = cnn

        .CommandType = adCmdStoredProc

        .CommandText = "sp_AddressSelection"

        '.NamedParameters = True

        .Parameters("@VendorID") = Me.Clinical_Site.Value

        Set rs = .Execute

    End With

    Set Me.Address_ID_1.Recordset = rs

    Set rs = Nothing

 

    cnn.Close

End Sub

Currently, upon load the combobox is blank, but the drop down is populated. I would prefer to have this loaded with the current record.




Thanks in advance,
Donald
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top