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!

setting a recordsource multiple times in the same form 1

Status
Not open for further replies.

striker73

MIS
Jun 7, 2001
376
US
I am trying to re-set my recordset by using the Me.Recordsource = "SELECT * FROM MyTable" command multiple times in the code of my form. The second time the compiler gets to this like I get the error message saying I am referring to an object that is closed or doesn't exist. I don't recall running into this problem earlier. Any ideas on what's going on?
 
Do you ever get to the end of your recordset? I think you need to reopen the recordset before each iteration. Before your Me.Recordset = "SELECT * FROM MYTABLE" I think you need Set Recordset = CurrentDb.OpenRecordset("...")

I think what's happening is the recordset is closed (like the message says) and you need to reopen it before you set a value.
 
I think you're right. I had a "Docmd.Close" line in between the two select statements, I was intending the form to be closed and not the database. Thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top