waseem0888
Member
- Local time
- Today, 07:37
- Joined
- Jul 25, 2020
- Messages
- 51
I have one form named Charts_Dashboard there i have the textbox name txtUnder_Review so in my textbox Control Source I was summing values from one of the query names qryDateRange with the following expression =DSum("[Under Review]","qryDateRange") It works fine. But now i have one parent form named frmMain and on that form, i have tab control and the page is named as P3 and then on that page, i have a subform named frmChart and in this form source Object i am using Charts_Dashboard and i don't know how to refer theses forms in my textbox on charts_dashboard to sum values from the query i tried many expressions but didn't work.
Second problem is on the same form, i am selecting date ranges via 2 text boxes through the below code so after attaching to the subform i have the same issue to refer to the parent forms.
Sub genrateReport()
Dim dateCriteria, dateRange As String
Me.Refresh
If IsNull(Me.txtStartDate) Or IsNull(Me.txtEndDate) Then
MsgBox "Please Enter Date Range...", vbiformation, "Date Range Required"
Me.txtStartDate.SetFocus
Else
dateCriteria = "([Submitted_Date] >= #" & Me.txtStartDate & "# And [Submitted_Date] <= #" & Me.txtEndDate & "#)"
dateRange = "Select Submitted_Date form Charts_Dashboard"
DoCmd.ApplyFilter dateRange
End If
End Sub
now it's giving an error
Runtime Error: 2491 "The action or method is invalid because the form or report isn't bound to a table or query".
Second problem is on the same form, i am selecting date ranges via 2 text boxes through the below code so after attaching to the subform i have the same issue to refer to the parent forms.
Sub genrateReport()
Dim dateCriteria, dateRange As String
Me.Refresh
If IsNull(Me.txtStartDate) Or IsNull(Me.txtEndDate) Then
MsgBox "Please Enter Date Range...", vbiformation, "Date Range Required"
Me.txtStartDate.SetFocus
Else
dateCriteria = "([Submitted_Date] >= #" & Me.txtStartDate & "# And [Submitted_Date] <= #" & Me.txtEndDate & "#)"
dateRange = "Select Submitted_Date form Charts_Dashboard"
DoCmd.ApplyFilter dateRange
End If
End Sub
now it's giving an error
Runtime Error: 2491 "The action or method is invalid because the form or report isn't bound to a table or query".