View Full Version : chrisk; Thanks for you quick response BUT...


majette97
06-25-2001, 06:36 AM
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!Con trols.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
06-25-2001, 07:11 AM
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
06-25-2001, 11:07 AM
Aname is a global variable which has a value.
When I code the following:

Forms!change_timecard!change_timecard_sub!txtAppNa me.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!