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

view with parameters as recordsource

P: n/a
Hi Newsgroup,

I have a little problem, probably someone can help me.
In a report, I have following code:

Private Sub Report_Open(Cancel As Integer)
Set db = CurrentDb
Set qdf = db.QueryDefs("ViewName")
qdf!Start = "01/01/2003"
qdf!End = "12/31/2003"
Set rs = qdf.OpenRecordset(dbOpenForwardOnly)
End Sub

The query works fine, but when I'm looking at the report, it prints
only one record. I can move within the recordset to force the report
printing an other record, but the report does not print the whole
resultset.
Is there any special report property I have to set or do I make any
other istake I'm blind for?

Thanks Tom
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
CDB
qdf.Parameters!Start = ?

Clive
"Tom Seichter" <to******@netscape.net> wrote in message
news:13**************************@posting.google.c om...
Hi Newsgroup,

I have a little problem, probably someone can help me.
In a report, I have following code:

Private Sub Report_Open(Cancel As Integer)
Set db = CurrentDb
Set qdf = db.QueryDefs("ViewName")
qdf!Start = "01/01/2003"
qdf!End = "12/31/2003"
Set rs = qdf.OpenRecordset(dbOpenForwardOnly)
End Sub

The query works fine, but when I'm looking at the report, it prints
only one record. I can move within the recordset to force the report
printing an other record, but the report does not print the whole
resultset.
Is there any special report property I have to set or do I make any
other istake I'm blind for?

Thanks Tom

Nov 12 '05 #2

P: n/a
Tom Seichter previously wrote:
Hi Newsgroup,

I have a little problem, probably someone can help me.
In a report, I have following code:

Private Sub Report_Open(Cancel As Integer)
Set db = CurrentDb
Set qdf = db.QueryDefs("ViewName")
qdf!Start = "01/01/2003"
qdf!End = "12/31/2003"
Set rs = qdf.OpenRecordset(dbOpenForwardOnly)
End Sub

The query works fine, but when I'm looking at the report, it prints
only one record. I can move within the recordset to force the report
printing an other record, but the report does not print the whole
resultset.
Is there any special report property I have to set or do I make any
other istake I'm blind for?

Thanks Tom

What you are doing in your Report_open event code has no bearing on your
report.
You are just opening a recordset in memory and leaving it there. It is
not related to the report in any way.

If you want to set the recordsource of your report you could copy the SQL
string of 'ViewName' as a string variable, sort out the parameter values
and then set the recordsource to the string

Something like (untested)

Dim strSQL
Dim vStart as date
dim vEnd as date

vStart = "01/01/2003"
vEnd = "12/31/2003"

strsql = "Select * from My table where myfield > #" & vStart & "# and
myfield < #" & vEnd & "#"

me.recordsource = strsql
Peter Russell

Nov 12 '05 #3

P: n/a
qdf.start =
gives the query the value of the parameter start
Tom

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.