Can the following be done?
rs.close
.
.
Set rs = rs.OpenRecordset("servicejobnew")
To me it doesn't make any sense.
Set rs = rs.OpenRecordset .......
-
- 3StarLounger
- Posts: 287
- Joined: 09 Mar 2010, 23:16
- Location: Canberra Australia
Re: Set rs = rs.OpenRecordset .......
You can close a recordset, then reuse the same rs variable to open a new recordset, but it should bePat wrote: Set rs = rs.OpenRecordset("servicejobnew")
Code: Select all
Set rs =db.OpenRecordset
Regards
John
John
-
- Administrator
- Posts: 78627
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Set rs = rs.OpenRecordset .......
Although the Recordset object does have an OpenRecordset method, I have no idea how it works. As John states, you should use the OpenRecordset method of the Database object (for DAO) or of the Connection object (for ADODB).
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 287
- Joined: 09 Mar 2010, 23:16
- Location: Canberra Australia
Re: Set rs = rs.OpenRecordset .......
I have just looked this up in my DAO book.
It seems that: (I think)
If you use rs.OpenRecordset you are opening a second recordset, so you should use
Set rsB = rs.OpenRecordset.
rsB will be a subset of the records in the first recordset.
It seems that: (I think)
If you use rs.OpenRecordset you are opening a second recordset, so you should use
Set rsB = rs.OpenRecordset.
rsB will be a subset of the records in the first recordset.
Regards
John
John
-
- Administrator
- Posts: 78627
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Set rs = rs.OpenRecordset .......
Thanks, that does work. If you filter rs using rs.Filter = "...", the second recordset rsB will only contain the filtered records.
But the example that Pat mentioned wouldn't work anyway - once you close a recordset, you can't open another recordset on it.
But the example that Pat mentioned wouldn't work anyway - once you close a recordset, you can't open another recordset on it.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 1148
- Joined: 08 Feb 2010, 21:27
Re: Set rs = rs.OpenRecordset .......
Thanks gents, this database has been inherited and i found that command.
As i said it didn't appear to make sense to me as you have verified.
As i said it didn't appear to make sense to me as you have verified.