How Do I Set RecordSource in VBA to a Predefined Query?

How Do I Set RecordSource in VBA to a Predefined Query

For example...
Me.RecordSource = qryAllUsers
Does not work.

Thanks,

Dave



Answer this question

How Do I Set RecordSource in VBA to a Predefined Query?

  • michael aird

    That was it, I knew I was missing something really easy.

    Thanks!

    Dave


  • Jay S

    Hey Dave,

    Do this instead...

    Me.RecordSource = "SELECT * FROM [qryAllUsers]"



  • Oren Novotny

    Is qryAllUsers a String containing the SQL select query text, or is it a QueryDef object

    RecordSource expects to be passed a String, not a QueryDef. If you're trying to pass the latter, it ought to be snagged as a compile-time error. Can you give any more information about how it "doesn't work"



  • How Do I Set RecordSource in VBA to a Predefined Query?