i was told to put this code under On Requisite, but i dont know what that is so i put it under On Open.
Private Sub Form_Load()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim qdf As QueryDef
'Note that YourDuerySQLstring should return one record
Set qdf = db.CreateQueryDef("", "SELECT Expr1 FROM qryActuals WHERE TaskNo =" & Chr(34) & Forms!frmAddJobEntry!frmAddJobEntrySubFormTasks!TaskNo & Chr(34))
Set rs = qdf.OpenRecordset(dbOpenDynaset)
rs.MoveFirst
Forms!frmAddJobEntry!frmAddJobEntrySubFormTasks!ActualCost = rs.Fields(11) 'where i=the column of your query holding the result you want
qdf.Close
rs.Close
db.Close
Set qdf = Nothing
Set rs = Nothing
Set db = Nothing
End Sub
except i cant get it workin.
im getting "Object Variable or With Block vairable not set" error???
Private Sub Form_Load()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim qdf As QueryDef
'Note that YourDuerySQLstring should return one record
Set qdf = db.CreateQueryDef("", "SELECT Expr1 FROM qryActuals WHERE TaskNo =" & Chr(34) & Forms!frmAddJobEntry!frmAddJobEntrySubFormTasks!TaskNo & Chr(34))
Set rs = qdf.OpenRecordset(dbOpenDynaset)
rs.MoveFirst
Forms!frmAddJobEntry!frmAddJobEntrySubFormTasks!ActualCost = rs.Fields(11) 'where i=the column of your query holding the result you want
qdf.Close
rs.Close
db.Close
Set qdf = Nothing
Set rs = Nothing
Set db = Nothing
End Sub
except i cant get it workin.
im getting "Object Variable or With Block vairable not set" error???