title: how to fill a recordset in vba in a module behind a db
body: <p>I have tried many ways to get the job done.  I am inexperienced with the<br>
  Access VBA.
  I think the problem is how to set the current database.  The code is in a module  from another db as the current db. I have paste the code here in a module behind the
  currentdb that also gives the same error. I have looked after very much questions. 
  It must be simple. But I don't see the answer. </p>
  
  <pre><code>Private Sub project()
  
  Dim projectnamen As DAO.Database
  Dim strSQL As String
  Dim rs As DAO.Recordset
  Dim strdbName As String
  Dim strMyPath As String
  Dim strdb As String
  Dim accapp As Object    
  
  Path = "c:\GedeeldeMappen\programma en bestanden stiko"
  strdbName="projektnamen.accdb"
  strMyPath = Path
  strdb = strMyPath &amp; "\" &amp; strdbName
  
  'make the db "projectnamen"current. Perhaps this is possible with set??
  
  Set accapp = CreateObject("Access.Application")  
  accapp.OpenCurrentDatabase (strdb)
  
  'fieldname is naam_van_het_project  
  'tablename is projectnaam    
  
  strSQL = "SELECT All naam_van_het_project FROM projectnaam;"
  
  'here i get an error "can't find the object Select All naam_van_het_project
  'FROM projectnaam"  error 3011
  
  Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenTable)
  rs.MoveFirst
  Do While Not rs.EOF
      MsgBox (rs)    
      rs.MoveNext
  Loop
  End Sub
  </code></pre>