D
Debbie C
Newbie to VBA, inherited legacy app, trying to fix a few features that haven't worked for a while. Form passes parms to qry. Qry returns correct data but rpt always returns 0 rows.
gstrRecordSource is global
Private Sub cmdSearch_Click()
gstrRecordSource = "qryRateSearch"
'Qry works fine
'DoCmd.OpenQuery gstrRecordSource
DoCmd.OpenReport "rptRate", acViewPreview
gstrRecordSource = "qryRuleSearch"
DoCmd.OpenReport "rptRule", acViewPreview
gstrRecordSource = "qryLocationSearch"
DoCmd.OpenReport "rptLocation", acViewPreview
End Sub
Private Sub Report_Open(Cancel As Integer)
' Something wrong, always returns 0 records
Me.RecordSource = gstrRecordSource
' 1-8-09 D Chin
' Tried this but no change
' Suspect not picking up forms parms
'Dim strSQL As String, rs As DAO.Recordset
'strSQL = "SELECT * FROM " & gstrRecordSource
'Set rs = CurrentDb.OpenRecordset(strSQL)
End Sub
Greatly appreciate advice.
EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com/default.aspx?ref=ng
gstrRecordSource is global
Private Sub cmdSearch_Click()
gstrRecordSource = "qryRateSearch"
'Qry works fine
'DoCmd.OpenQuery gstrRecordSource
DoCmd.OpenReport "rptRate", acViewPreview
gstrRecordSource = "qryRuleSearch"
DoCmd.OpenReport "rptRule", acViewPreview
gstrRecordSource = "qryLocationSearch"
DoCmd.OpenReport "rptLocation", acViewPreview
End Sub
Private Sub Report_Open(Cancel As Integer)
' Something wrong, always returns 0 records
Me.RecordSource = gstrRecordSource
' 1-8-09 D Chin
' Tried this but no change
' Suspect not picking up forms parms
'Dim strSQL As String, rs As DAO.Recordset
'strSQL = "SELECT * FROM " & gstrRecordSource
'Set rs = CurrentDb.OpenRecordset(strSQL)
End Sub
Greatly appreciate advice.
EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com/default.aspx?ref=ng