frankiebakerjr
04-27-2005, 07:23 PM
I can't update the value of a textbox of a report. The textbox is unbound, and I get an error when I attempt to update the textbox, and the Text property doesn't display in the intellisence popup.
Please save me! :)
Pat Hartman
04-27-2005, 09:58 PM
1. The .text property is not available for a textbox on a report.
2. Even in a form you would almost never use the .text property. It is only available during the time that the cursor is actually in a control.
What are you trying to do? If you want to calculate the value for a textbox, it will be something like:
Me.YourUnboundTextBox = (Me.fldA + Me.fldB) * Me.fldC
frankiebakerjr
04-28-2005, 03:20 AM
Hello Pat. Thanks for the reply.
I have a form that I prompt for a date range that I use in the WhereConditions parmater of the OpenReport method:
DoCmd.OpenReport strReportName, acViewPreview, , strFilter, , Trim(strStartDate & " " & strEndDate)
Passing the start and end dates in the OpenArgs parameter. In my report, I have a two unbound text boxes in the PageHeader section to display the date range of the report.
Below is my code in the report
Private Sub Report_Open(Cancel As Integer)
Dim strStartDate As String, strEndDate As String
Dim lngPos As Long
'parse out the date range
If Me.OpenArgs > vbNullString Then
'at least 1 date passed
lngPos = InStr(1, Me.OpenArgs, " ")
If lngPos > 0 Then
'both dates are populated because there is a space between the two
'example "1/1/2005 2/1/2005"
strStartDate = Mid(Me.OpenArgs, 1, lngPos - 1)
strEndDate = Mid(Me.OpenArgs, lngPos + 1)
Else
'only 1 date is populated because there is no space
'example "1/1/2005"
strStartDate = Me.OpenArgs
End If
End If
Me.txtStartDate = strStartDate
Me.txtEndDate = strEndDate
End Sub
Scrap your code and just put =[Forms]![YourForm]![YourTextBox] as the control source for the textboxes on the report, as long as the form remains open the dates will display
frankiebakerjr
04-28-2005, 04:02 PM
Thanks Rich. That did the trick.