trying to assign a control on a report a value from a table and am getting an error message desc
trying to assign a control on a report a value from a table and am getting an error message described belowI have a report module in MS Access 2003 and I know I have written code to do this before but I cannot get it to work! Please Help. A copy of the module is displayed below. when I run this code I get the following MS VB error: Run-time error '2448'; You can't assign a value to this object. I haven't programmed in almost 4 years but I know I have done this before. I have a textbox control on the form named MainLanes which I am trying to put data into. Please Help ASAP! Thanks
Option Compare Database
Dim db As Database
Dim rst As Recordset
Dim TotalRecs As Long
Dim i As Long
Dim District As String
Dim REC As Integer
Dim di_int As Integer
Dim stringname As String
Private Sub report_open(Cancel As Integer)
Set db = CurrentDb()
'Set rst = db.OpenRecordset("SELECT System.REC,System.HWY_STAT,System.DI,System.LEN_SEC,System.RDBD_ID FROM System ORDER BY System.REC System.HWY_STAT,System.District,System.RDBD_ID")
Set rst = db.OpenRecordset("System")
TotalRecs = rst.RecordCount
rst.MoveLast
rst.MoveFirst
'Debug.Print TotalRecs
If rst.RecordCount > 0 Then
For i = 1 To TotalRecs
'Debug.Print rst.REC
'Debug.Print "District ID:" & rst!DI
'Debug.Print "HWY_STAT:" & rst!HWY_STAT
'Debug.Print "HWY_SYS:" & rst!HSYS
'Debug.Print "LEN_SEC:" & rst!LEN_SEC
'Debug.Print "RDBD_ID:" & rst!RDBD_ID
'Reports![Fill Report]![Quantity] = rs![QuantityPerUnit]
Me!MainLanes = rst!LEN_SEC
'Me![MainLanes] = rst!LEN_SEC
'Debug.Print Me!MainLanes
stringname = Me!MainLanes.Visible
'Debug.Print stringname
'Debug.Print Me!MainLanes
'Me!MainLanes = "this is the date"
'Debug.Print i
rst.MoveNext
Next i
End If
End Sub

