|
-
Jun 23rd, 2005, 03:33 AM
#1
Thread Starter
Member
ReSOLVED : Report RecordSource property !
Hi All,
I am trying to set Recordsource property of a report with VBA code. Is it necessary to open the report in design view first and then only I can set Recordsource property, As I am doing here ?
When I set the Recordsource property of Report without openning it in Design view I get an error message saying report is not open etc.
My VBA code is as follows :
---------------Code--------------------
str1 = "SELECT tbTimeSheet.DateRec, tbTimeSheet.PrjID, tbActivity.ActName, tbTimeSheet.ActCode, tbTimeSheet.Duration, tbTimeSheet.Remark, tbTimeSheet.EmpID" _
& " FROM tbActivity INNER JOIN tbTimeSheet ON tbActivity.ActCode = tbTimeSheet.ActCode" _
& " WHERE (((tbTimeSheet.EmpID)='" & EmpIDFT & "') AND ((Format([tbTimeSheet]![DateRec],'ww',2,3))>=" & cmbFrom.Value & " And (Format([tbTimeSheet]![DateRec],'ww',2,3))<=" & cmbTo.Value & "))"
DoCmd.Close acForm, "TmpInfo"
DoCmd.OpenReport "REmpRep", acViewDesign Reports!RempRep.RecordSource = str1
Reports!RempRep.Label20.Caption = "Report for " & EmpNameFT & "(Employee Code : " & EmpIDFT & ")"
DoCmd.Close acReport, "REmpRep", acSaveYes
DoCmd.OpenReport "REmpRep", acViewPreview
----------------------Code----------------------------
Can I change the Recordsource property without opening the report ? How ?
Please help.
Regards,
Alankar
Last edited by Alankar; Jun 24th, 2005 at 04:09 AM.
The rest of mind is not in rest, It rests in rest. 
-
Jun 23rd, 2005, 09:17 AM
#2
Hyperactive Member
-
Jun 24th, 2005, 04:06 AM
#3
Thread Starter
Member
Resolved: Report RecordSource property !
OK, finally I have done.
I transferred the recordsource property on Report OnLoad event with using some global variable.
Thanks for help.
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
|