I'm having trouble using a forms name in a subroutine.



Code:
Private Sub FillLookup(strFormName As String)
Dim ctl As Control


DoCmd.OpenForm strFormName, acNormal, , , , acHidden

For Each ctl In Forms!Forms(strFormName).Controls
    If TypeOf ctl Is ComboBox Then
        MsgBox (ctl.RowSource)
    End If
Next ctl

DoCmd.Close acForm, strFormName, acSaveNo
End Sub
Right now this gives the error "Access can't find form [Name I have passed]"


I want this to display the rowsource for each combobox on the passed form (it will eventually do more with that besides display it). This works great if I physically hard code the forms name into the code, but I need adapt this so it can work for lots of different forms.


EDIT: SOLVED:

After messing around with it for a bit more I relized I was setting the form twice kinda and that made it not work. Here's the working code:
Code:
Private Sub FillLookup(strFormName As String)
Dim ctl As Control
Dim FormName As Form

DoCmd.OpenForm strFormName

Set FormName = Forms("Grad Student Information")

For Each ctl In FormName.Controls
    If TypeOf ctl Is ComboBox Then
        MsgBox (ctl.RowSource)
    End If
Next ctl

DoCmd.Close acForm, strFormName
End Sub