Hi all...
I'm sending along a var -- a string really -- to a DataReport page. Therein, I'll use it to check for a match in my Access dbase to run a record set.
The thing is, the DataReport form wont catch that var???
Here's the code...
and then this is the setup script on the DataReports form...Code:sending the var here.... Private Sub cmdReport_Click() taskName = cmbClientList.Text ' this makes the comboList current text name a var to pass to the Reports page... Debug.Print "sending taskName as " & taskName DataReport1.SetupRecord (clientName) ' send the app to the report form with proper vars already there... DataReport1.Show ' show the report form End Sub
When it runs, and I select a client name --which properly shows up in the Immediate window, it never reaches the DataReports form....???Code:Public clientName As String Public taskName As String Public Sub SetupRecord(clientName) On Error GoTo ErrHandler Dim cnCater As ADODB.Connection Dim rsCater As ADODB.Recordset Dim sSql As String Set cnCater = SetConnection Set rsCater = SetRecordset cnCater.Open Dim strDate1 As String strDate1 = frmMainPage.ReportStart.Value ' grab start date from DTPicker start Dim strDate2 As String strDate2 = frmMainPage.ReportEnd.Value ' grab end date from DTPicker end Debug.Print "catching " & taskName sSql = "SELECT [username], [name], item, [day], timein, timeout, totalhours, comments, rate, (rate * totalhours) AS totals FROM clients WHERE done = TRUE AND [name] = '" & taskName & "' AND [day] BETWEEN #" & strDate1 & "# AND #" & strDate2 & "#" rsCater.Open sSql, cnCater, adOpenDynamic, adLockOptimistic ' open that rs with that sql string... Set Me.DataSource = rsCater ' set the report to this datasource... clientName = rsCater.Fields("username") Me.Sections("section4").Controls("lblclientNameHolder").Caption = "for: " & clientName ' add personalization to top section here... Me.Sections("section3").Controls("lbltaskName").Caption = "TASKNAME PASSED IS " & taskName ' testing to see what was passed along...so far NOTHING!!! ErrHandler: ' MsgBox "Sorry, there are no records on any completed tasks within that timeframe!", vbExclamation Exit Sub End Sub
Help here guys, what am I missing?
Jim




Reply With Quote