By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,775 Members | 2,658 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,775 IT Pros & Developers. It's quick & easy.

Recordset basics - How to set Form Recordset?

P: n/a
I have several stored queries that provide views based on user selection -
selection criteria is stored in strPxSx, and the query called would then be
"qrySearch24" or "qrySearch19", for example.

I'm somewhat of a rookie when it comes to working with Recordsets, but this
is what I'm trying to do:

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Set dbs = CurrentDb
Set rst = dbs.QueryDefs("qrySearch" & strPxSx).OpenRecordset
Me.RecordSource = dbs.QueryDefs("qrySearch" & strPxSx).OpenRecordset
?????????
Me.Requery

The desired outcome is to use the Recordset as the RecordSource for the
Form - so only records that are found in qrySearch24 are displayed in the
Form.

Another (much slower) way to do this is:

strSqlFilter = "[Entity_ID] IN (SELECT DISTINCT Entity_ID FROM qrySearch" &
strPxSx & ")"
Me.Filter = strSqlFilter
Me.FilterOn = True

Can anyone help me do this with a recordset?

Thanks in advance!
Nov 12 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Set the RecordSource of the Form to the SQL that you would use to open the
Recordset. A Form's RecordSource is not a Recordset, it is a string Value
that is used to obtain the Records. It can be either the name of a saved
Query or an SQL statement (which by definition is text).

Larry Linson
Microsof Access MVP

"deko" <dj****@hotmail.com> wrote in message
news:az*****************@newssvr27.news.prodigy.co m...
I have several stored queries that provide views based on user selection -
selection criteria is stored in strPxSx, and the query called would then be "qrySearch24" or "qrySearch19", for example.

I'm somewhat of a rookie when it comes to working with Recordsets, but this is what I'm trying to do:

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Set dbs = CurrentDb
Set rst = dbs.QueryDefs("qrySearch" & strPxSx).OpenRecordset
Me.RecordSource = dbs.QueryDefs("qrySearch" & strPxSx).OpenRecordset
?????????
Me.Requery

The desired outcome is to use the Recordset as the RecordSource for the
Form - so only records that are found in qrySearch24 are displayed in the
Form.

Another (much slower) way to do this is:

strSqlFilter = "[Entity_ID] IN (SELECT DISTINCT Entity_ID FROM qrySearch" & strPxSx & ")"
Me.Filter = strSqlFilter
Me.FilterOn = True

Can anyone help me do this with a recordset?

Thanks in advance!

Nov 12 '05 #2

P: n/a

"deko" <dj****@hotmail.com> wrote in message
news:az*****************@newssvr27.news.prodigy.co m...
I have several stored queries that provide views based on user selection -
selection criteria is stored in strPxSx, and the query called would then be "qrySearch24" or "qrySearch19", for example.

I'm somewhat of a rookie when it comes to working with Recordsets, but this is what I'm trying to do:

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Set dbs = CurrentDb
Set rst = dbs.QueryDefs("qrySearch" & strPxSx).OpenRecordset
Me.RecordSource = dbs.QueryDefs("qrySearch" & strPxSx).OpenRecordset
?????????
Me.Requery

The desired outcome is to use the Recordset as the RecordSource for the
Form - so only records that are found in qrySearch24 are displayed in the
Form.

Another (much slower) way to do this is:

strSqlFilter = "[Entity_ID] IN (SELECT DISTINCT Entity_ID FROM qrySearch" & strPxSx & ")"
Me.Filter = strSqlFilter
Me.FilterOn = True

Can anyone help me do this with a recordset?

Thanks in advance!


Go to: http://www.mvp.com
Best Regards
Didi Omark (MVP)
Nov 12 '05 #3

P: n/a
what is with the sportswear web site link.....
Nov 12 '05 #4

P: n/a

"hal boyles" <ha********@timeinc.com> wrote in message
news:bk**********@inntp-m1.news.aol.com...
what is with the sportswear web site link.....

That's probably because Microsoft stole "MVP" from the sports world. Either
that, or MVP's are so stupid they don't even know their own Web address.
Nov 12 '05 #5

P: n/a
10-4 ... thanks for clearing that up...

I'm now using an SQL string for the recordsource instead using the filter --
better, but it is still pretty slow...

thanks again for the help!

"Larry Linson" <bo*****@localhost.net> wrote in message
news:NR*****************@nwrddc01.gnilink.net...
Set the RecordSource of the Form to the SQL that you would use to open the
Recordset. A Form's RecordSource is not a Recordset, it is a string Value
that is used to obtain the Records. It can be either the name of a saved
Query or an SQL statement (which by definition is text).

Larry Linson
Microsof Access MVP

"deko" <dj****@hotmail.com> wrote in message
news:az*****************@newssvr27.news.prodigy.co m...
I have several stored queries that provide views based on user selection - selection criteria is stored in strPxSx, and the query called would then be
"qrySearch24" or "qrySearch19", for example.

I'm somewhat of a rookie when it comes to working with Recordsets, but

this
is what I'm trying to do:

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Set dbs = CurrentDb
Set rst = dbs.QueryDefs("qrySearch" & strPxSx).OpenRecordset
Me.RecordSource = dbs.QueryDefs("qrySearch" & strPxSx).OpenRecordset
?????????
Me.Requery

The desired outcome is to use the Recordset as the RecordSource for the
Form - so only records that are found in qrySearch24 are displayed in the Form.

Another (much slower) way to do this is:

strSqlFilter = "[Entity_ID] IN (SELECT DISTINCT Entity_ID FROM

qrySearch" &
strPxSx & ")"
Me.Filter = strSqlFilter
Me.FilterOn = True

Can anyone help me do this with a recordset?

Thanks in advance!


Nov 12 '05 #6

P: n/a
"hal boyles" <ha********@timeinc.com> wrote:
what is with the sportswear web site link.....


Another posting by Don P Mellon.

Tony

--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.