Can't update a Report fiels

  • Thread starter Thread starter Jim Shaw
  • Start date Start date
J

Jim Shaw

BlankI developed this code from an example on page 402 in "Beginning Access
2002 VBA" from WROX. It used to work, but now it does not work anymore.
What could I have possibly done to break this code?

I have a report ("rptJobApplicantLog") that opens a form in the report's
Open Event. In the form, the user specifies two dates which are used in the
report's filter. I'm able to return the filter string back to the report,
but I can't return values to a textbox ("txtFilter") in the report header to
announce to the report readers that the report is filtered. Nor can I set
its visibility if I comment out the assignment statement.

I have done all that I know to do to deal with possible corruption in the
db. I've deleted the report & form, decompiled the db, Imported the
application into a new db, rebuilt the report & form, and compiled with no
errors.

In the form's VBA code below, at the point indicated, I get a runtime error
"You can't assign a value to this object".

Option Compare Database
Dim m_rptAppLog As Report
--------------------------------------------------------------------

Private Sub Form_Load()
Set m_rptAppLog = Reports("rptJobApplicantLog")
End Sub

Private Sub cmdOK_Click()
Dim txtWhere as String
Dim strWHERE as String
...
txtWhere = dtePeriodStart & "Thru " & dtePeriodStart
strWHERE = "[EffectiveDate] >= #" & dtePeriodStart & "# AND
[EffectiveDate] <+ #" & dtePeriodEnd & "#"
With m_rptAppLog
.Filter = strWHERE
.FilterOn = True
.txtFilter = txtWhere 'I get the error message at
this point
.txtFilter.Visible = True
.lblFilter.Visible = True
End With
End Sub
---------------------------------------------End of Code---------------

Thanks for your help on this
-Jim
 
Jim

The error message you mention suggests that you/your code is trying to
assign a value to something. Where in your code does this happen?

If you aren't sure, consider setting a breakpoint in your code and stepping
through it line-by-line until it breaks. This will point to the line that
is causing the problem, giving you more clues.
 
Jeff
I'm tryng to set the value at the point in my code where I make the comment
"'I get the error message at this statement".
I'm trying to set the value "m_rptAppLog.txtFilter" to the value "txtWhere"
Jim

Jeff Boyce said:
Jim

The error message you mention suggests that you/your code is trying to
assign a value to something. Where in your code does this happen?

If you aren't sure, consider setting a breakpoint in your code and stepping
through it line-by-line until it breaks. This will point to the line that
is causing the problem, giving you more clues.

--
Good luck

Jeff Boyce
<Access MVP>

Jim Shaw said:
BlankI developed this code from an example on page 402 in "Beginning Access
2002 VBA" from WROX. It used to work, but now it does not work anymore.
What could I have possibly done to break this code?

I have a report ("rptJobApplicantLog") that opens a form in the report's
Open Event. In the form, the user specifies two dates which are used in the
report's filter. I'm able to return the filter string back to the report,
but I can't return values to a textbox ("txtFilter") in the report
header
to
announce to the report readers that the report is filtered. Nor can I set
its visibility if I comment out the assignment statement.

I have done all that I know to do to deal with possible corruption in the
db. I've deleted the report & form, decompiled the db, Imported the
application into a new db, rebuilt the report & form, and compiled with no
errors.

In the form's VBA code below, at the point indicated, I get a runtime error
"You can't assign a value to this object".

Option Compare Database
Dim m_rptAppLog As Report
--------------------------------------------------------------------

Private Sub Form_Load()
Set m_rptAppLog = Reports("rptJobApplicantLog")
End Sub

Private Sub cmdOK_Click()
Dim txtWhere as String
Dim strWHERE as String
...
txtWhere = dtePeriodStart & "Thru " & dtePeriodStart
strWHERE = "[EffectiveDate] >= #" & dtePeriodStart & "# AND
[EffectiveDate] <+ #" & dtePeriodEnd & "#"
With m_rptAppLog
.Filter = strWHERE
.FilterOn = True
.txtFilter = txtWhere 'I get the error message at this statement
this point
.txtFilter.Visible = True
.lblFilter.Visible = True
End With
End Sub
---------------------------------------------End of Code---------------

Thanks for your help on this
-Jim
 
More information on this problem...(Context Access 2002)
I converted my application from *.mdb to *mde
The logic works in the *.mde version, but not in the *.mdb version.
Go figure!!??

Cheers
Jim



Jeff Boyce said:
Jim

The error message you mention suggests that you/your code is trying to
assign a value to something. Where in your code does this happen?

If you aren't sure, consider setting a breakpoint in your code and stepping
through it line-by-line until it breaks. This will point to the line that
is causing the problem, giving you more clues.

--
Good luck

Jeff Boyce
<Access MVP>

Jim Shaw said:
BlankI developed this code from an example on page 402 in "Beginning Access
2002 VBA" from WROX. It used to work, but now it does not work anymore.
What could I have possibly done to break this code?

I have a report ("rptJobApplicantLog") that opens a form in the report's
Open Event. In the form, the user specifies two dates which are used in the
report's filter. I'm able to return the filter string back to the report,
but I can't return values to a textbox ("txtFilter") in the report
header
to
announce to the report readers that the report is filtered. Nor can I set
its visibility if I comment out the assignment statement.

I have done all that I know to do to deal with possible corruption in the
db. I've deleted the report & form, decompiled the db, Imported the
application into a new db, rebuilt the report & form, and compiled with no
errors.

In the form's VBA code below, at the point indicated, I get a runtime error
"You can't assign a value to this object".

Option Compare Database
Dim m_rptAppLog As Report
--------------------------------------------------------------------

Private Sub Form_Load()
Set m_rptAppLog = Reports("rptJobApplicantLog")
End Sub

Private Sub cmdOK_Click()
Dim txtWhere as String
Dim strWHERE as String
...
txtWhere = dtePeriodStart & "Thru " & dtePeriodStart
strWHERE = "[EffectiveDate] >= #" & dtePeriodStart & "# AND
[EffectiveDate] <+ #" & dtePeriodEnd & "#"
With m_rptAppLog
.Filter = strWHERE
.FilterOn = True
.txtFilter = txtWhere 'I get the error message at
this point
.txtFilter.Visible = True
.lblFilter.Visible = True
End With
End Sub
---------------------------------------------End of Code---------------

Thanks for your help on this
-Jim
 
Back
Top