Use a value from a subform to a report.

shamal

Registered User.
Local time
Today, 15:35
Joined
Sep 28, 2013
Messages
84
Hello
I have a main form called All_Name, which contains a sub-report called Payment
In the sub-form there is a text box representing the start date, a text box for the end date, and a command button to open a report called Account.
The problem is that when opening the report, the values appear in this incomprehensible way.
How can this be solved?
 

Attachments

  • 30.png
    30.png
    29 KB · Views: 39
What's in the Control Source of those boxes?
 
Show the values of those controls in design view.
Copy and paste the source back here for each one.
 
Last edited:
#Name? ... means that something is unknown. The existing rule of getting values from somewhere doesn't work like that.

The first step should therefore be to look at what exactly you are doing. So, what do you have planned? Simply complaining is of no use.

It makes more sense, also in the sense of object-oriented programming, to pass content to exactly the desired position. If you give something directly to the hand, it is more reliably available than if the hand has to search for and grab something somewhere.
For such a transfer you can use the OpenArgs argument in OpenReport.

Code:
DoCmd.OpenReport "Account", acViewNormal, , , , "BeginDate~" & Me.txtBeginDate & "|" & "EndDate~" & Me.txtEndDate

' ----------------------------------------------------------------------------------------------

Private Sub Report_Open(Cancel As Integer)
   Dim sArray() As String
   If Not IsNull(Me.OpenArgs) Then
      sArray = Split(Me.OpenArgs, "|")
      Me.txtBeginDate = CDate(Split(sArray(0), "~")(1))
      Me.txtEndDate = CDate(Split(sArray(1), "~")(1))
   End If
End Sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom