chrisk; Thanks for you quick response BUT... (1 Viewer)

majette97

Registered User.
Local time
Today, 04:11
Joined
Apr 26, 2001
Messages
23
See my code below (it is not displaying the values of the days of week on my subform.)
I get a message that it cannot find the field/form.Private Sub WeekNo_AfterUpdate()
Dim rs As Object
Dim rs2 As Object
Dim strSql As String

strSql = "select * from timecard where WeekNo = #" & WeekNo.Text & "#"
Set rs = CurrentDb.OpenRecordset(strSql)

strSql = "select * from subtimecard where TimeNo = " & rs.Fields("TimeNo").Value
Set rs2 = CurrentDb.OpenRecordset(strSql)

Forms!change_timecard!change_timecard_sub.Form!Controls.txtAppName = AName (Doesn't work)
Me![txtTaskName] = TName
Me![Monday] = rs2![MON]
Me![Tuesday] = rs2![TUE]
Me![Wednesday] = rs2![WED]
Me![Thursday] = rs2![THU]
Me![Friday] = rs2![FRI]

rs.Close
rs2.Close
End Sub

Can you help?? Thanks
 

chrisk

Registered User.
Local time
Today, 04:11
Joined
Apr 24, 2001
Messages
13
So, txtAppName is a textbox on change_timecard_sub which is a sub form of change_timecard? Is AName a field returned by your SQL SELECT? If so:

Forms![change_timecard]![change_timecard_sub]![txtAppName] = rs2.Fields(n-1)

where n is the number of the field returned by the SQL (ie the first field will be Fields(0), the 2nd field is Fields(1), etc)

If I'm missing the point, can you be more specific about what you're trying to do?

Chris
 

majette97

Registered User.
Local time
Today, 04:11
Joined
Apr 26, 2001
Messages
23
Aname is a global variable which has a value.
When I code the following:

Forms!change_timecard!change_timecard_sub!txtAppName.text = Aname

I receive ERROR: The property is read only and can't be set.

Where should I change the property?


Thanks for your quick responses!
 

Users who are viewing this thread

Top Bottom