Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2006

Tip: Looking for answers? Try searching our database.

managing textbox value while formatting the report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rocco - 07 Jan 2006 15:23 GMT
hello,
from some other post I have read that textbox value can be changed throught
the format event of a report section.
If this is true, why this code wont work?
<code>
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
   Application.Echo False
   Dim rst As ADODB.Recordset
   Set rst = New ADODB.Recordset
   Dim ctl As Control
   rst.Open "tblabs", CurrentProject.Connection, adOpenStatic, adLockReadOnly
   Dim i As Integer
   With rst
       .Filter = "strpazid='" & Forms("totali").codfisc & "'"
       For Each ctl In Reports("reportabs2").Controls
           If ctl.Name Like "q*" Then
               Select Case .Fields(ctl.Name)
               Case Is = 1
               ctl.Value = "SI"
               Case Is = 0
               ctl.Value = "NO"
               Case Is = 9
               ctl.Value = "N/A"
               End Select
           End If
       Next ctl
   End With
</code>

It stops on whene trying to write value for the first ctl saying "You cannot
assign value to this object".

thanks
Rocco
Marshall Barton - 07 Jan 2006 16:05 GMT
>from some other post I have read that textbox value can be changed throught
>the format event of a report section.
[quoted text clipped - 26 lines]
>It stops on whene trying to write value for the first ctl saying "You cannot
>assign value to this object".

That message implies that the control does not have a value
property (e.g. label) or that the control is bound to a
field or expression.  Make sure that that all the "q"
controls are unbound text boxes.

Signature

Marsh
MVP [MS Access]

rocco - 08 Jan 2006 07:26 GMT
thanks. You were right: I haven't checked the controlsource...they were
bounded.

> >from some other post I have read that textbox value can be changed throught
> >the format event of a report section.
[quoted text clipped - 31 lines]
> field or expression.  Make sure that that all the "q"
> controls are unbound text boxes.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.