View Full Version : How to reference one form to another form


majette97
06-25-2001, 05:52 AM
How to point Me to subform? OR How to reference one form to another form. (Isn't this one in the same or is there more than one way to reference?) See my code below:
(The values for the days of the week are not displaying on the subform.)

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

Need help ASAP!
Thanks for any assistance!


[This message has been edited by majette97 (edited 06-25-2001).]

chrisk
06-25-2001, 06:03 AM
To refer to YourControl on subform YourSubform of main form YourMainForm:

Forms![YourMainForm]![YourSubform]![YourControl]

HTH
Chris