Changed recordsource = nodata

A

Atlas

I've read that changing the report's recordsource @ runtime doesn't fire the
nodata event if no recs are present.
How can I detetct it ?

I'm passing the new recordsource to the report through a global variable
string containg the select statement.

Dunno why but looking in the debugger's locals window the statement after

me.recordsource = globalSQLString

shows that me.recordset = nothing, so I can't test .recordcount
property......

Help!
 
G

Guest

eh? I have many reports in both Access 97 and 2000 where I set the recordsource at runtime and use the no_event property on the report. It has always worked a treat

Here is a snippet on how I have got it working fine

Private Sub Report_Open(Cancel As Integer

Dim sqlstring As Strin

Select Case monito

Case "Unknown referral source
sqlstring = "SELECT Referrals.[Referral Key], Referrals.[Hospital number], Referrals.Forename, Referrals.Surname, Referrals.[Referral source], Referrals.Username, Referrals.[Date referral received] "
& "FROM Referrals LEFT JOIN [Referring Trusts] ON Referrals.[Referral source rsno] = [Referring Trusts].[ICHIS RSNO] "
& "WHERE (((Referrals.[Date referral received]) Between [Forms]![Data Quality Monitoring]![txtstdate] And [Forms]![Data Quality Monitoring]![txtendate]) AND ((Referrals.[Referral code])<>'G') AND (([Referring Trusts].[ICHIS Name]) Is Null));
txt4.ControlSource = "Referral source
txt5.ControlSource = "Username
txt6.ControlSource = "Date referral received
lbl4.Caption = "Referral source
lbl5.Caption = "Entry clerk username
lbl6.Caption = "Date received
End Selec

DoCmd.Maximiz
Me.RecordSource = sqlstrin

End Su

Private Sub Report_NoData(Cancel As Integer
MsgBox "There is no data in this time period", vbInformation, "No Data
Cancel = Tru
End Su

Hope you get it

Basi
PS Where did you read that this won't work anyway?


----- Atlas wrote: ----

I've read that changing the report's recordsource @ runtime doesn't fire th
nodata event if no recs are present
How can I detetct it

I'm passing the new recordsource to the report through a global variabl
string containg the select statement

Dunno why but looking in the debugger's locals window the statement afte

me.recordsource = globalSQLStrin

shows that me.recordset = nothing, so I can't test .recordcoun
property.....

Help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top