|
-
Jun 29th, 2005, 06:03 AM
#1
Thread Starter
Member
Table Update ! **Resolved**
Hi there,
I am in a trouble, please help me. I am working in Access 2003 MDB and all the tables are linked tables.
I have a table which stores project records (one record for each project). In this table there is a field which I want to edit.
The value of this field is to be taken from another table having many records for each project. The value is the sum of a field in this table if Project ID matches in both the table.
I have to do this by VBA or if I create a update query then also it is possible.
*******************CODE*******************
Private Sub Report_Open(Cancel As Integer)
'Enter this project's total Actual Time
Set DB = CurrentDb()
sql1 = "select tbproject.* from tbProject WHERE tbProject.ProjectID = '" & Form_TmpInfoPrj.cmbPrj.Value & "'"
Set rst = DB.OpenRecordset(sql1, dbOpenDynaset)
rst![ActPrjHrs] = "SELECT (Int(CSng(Sum([Duration])))*24)+Format(Sum([Duration]),'hh') & ' : ' & Format(Sum([Duration]),'nn') AS Expr1" _
& " FROM tbTimeSheet INNER JOIN tbProject ON tbTimeSheet.PrjID = tbProject.PrjID" _
& " GROUP BY tbProject.PrjID HAVING (((tbProject.PrjID)='" & Form_TmpInfoPrj.cmbPrj.Value & "))"
rst.Update
rst.Close
DB.Close
Set rst = Nothing
Set DB = Nothing
Report_RPrjRep.RecordSource = RepStr
End Sub
****************************CODE*****************
The execution stuck at the red line why, I can't understand.
Regards,
Alankar
Last edited by Alankar; Jun 30th, 2005 at 07:18 AM.
The rest of mind is not in rest, It rests in rest. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|