I need assistance loading a subForm in my Access application

Hi Experts,
I am trying to load data into a subForm in my Access application.  Here is my sub procedure where I load the data into a recordset.  Now how do I load the data into my subForm?  My subForm has the following text fields; txtName, txtBirthDate, and txtCurrent age.  Please help.  Thank in advance.  Below is my code:

Private Sub cmdSearch_Click()
    Dim strSQL As String
    Dim strSQLW As String
   
    Dim adoRS As New ADODB.Recordset
    Dim adoCN As New ADODB.Connection
    Dim adoCmd As New ADODB.Command
    Dim strItems As String
    Dim strConn As String
   
    '******* Get the assocaite info from the db *******
    strConn = modConnTools.fL50_GetConnString("FAEAGLE")
   
    With adoCN
        .ConnectionString = strConn
        .Open
    End With
     
     With adoCmd
        .CommandText = "dbo.u_TestDate_TestProc_ssp"
        .CommandType = adCmdStoredProc
         '.Parameters.Append .CreateParameter("RetVal", adInteger, adParamReturnValue)
         '.Parameters.Append .CreateParameter("AID", adBigInt, adParamInput, , lngAid)
        .ActiveConnection = adoCN
    End With
   
    'Set the cursor location to client
    With adoRS
        .CursorLocation = adUseClient
        .CursorType = adOpenStatic
        .LockType = adLockBatchOptimistic
        Set .Source = adoCmd
        .Open
    End With
   
    'Disconnect the recordset
    Set adoRS.ActiveConnection = Nothing
    If adoCN.State = adStateOpen Then adoCN.Close
   
   
    Set Me.subForm.Form.Recordset = adoRS
   
    'Now load the new data
    'If Not (adoRS.EOF And adoRS.BOF) Then
           
    '    Do Until adoRS.EOF
                     
                     
                     
     '   adoRS.MoveNext
     '   Loop
   ' End If
   
   
   
ExitCode:
    If adoRS.State = adStateOpen Then adoRS.Close
    Set adoRS = Nothing
    If adoCN.State = adStateOpen Then adoCN.Close
    Set adoCN = Nothing
    Set adoCmd = Nothing
   
    'gstrArg = ""
    Exit Sub
       
ErrTrap:
    Call MsgBox(Err.Number & " " & Err.Description & " frm02 - Assocate " & " Load ", vbCritical, "Error opening form")
    Resume ExitCode
   
End Sub
mainrotorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CGretskiCommented:
I think your problem is that you are destroying your record set  before you then try to use data in it.

Take out the lines:
   
    'Disconnect the recordset
    Set adoRS.ActiveConnection = Nothing
    If adoCN.State = adStateOpen Then adoCN.Close
   
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.