How can I assign a recordsource to my report, rptStudents at runtime? Note:
I cannot use Me!ReportName because this is a sub procedure. It's called by
another sub procedure. Thank you
--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201003/1
DoCmd.OpenReport rptStudents, acViewPreview,,,,rst
And then, in the Open event of the report, I put this following code.
Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = rst.NAME
End Sub
STILL DOESN'T WORK! Do you know why? Thank you!
---------
"ruralguy via AccessMonster.com" wrote:
> .
>
Private Sub Report_Open(Cancel As Integer)
Set Me.RecordSet = rst
End Sub
--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)
"Tim" <T...@discussions.microsoft.com> wrote in message
news:569992EC-FCAF-4332...@microsoft.com...
"Douglas J. Steele" wrote:
> .
>
--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)
"Tim" <T...@discussions.microsoft.com> wrote in message
news:DA3B438B-EA53-49C6...@microsoft.com...
Set my workspace = DBEngine.Workspace(0)
Set DB = CurrentDb
strSQL = "SELECT tblStudents.StudID, tblStudents.SName WHERE
tblStudents.StudID= '" & glbStudID & "'
Set rst = MyDatabase.OpenRecordset(strSQL)
Do you see any thing wrong with it? Thanks
"Douglas J. Steele" wrote:
> .
>
strSQL = "SELECT tblStudents.StudID, tblStudents.SName WHERE
tblStudents.StudID= '" & glbStudID & "'
Your quotes are wrong at the end
strSQL = "SELECT tblStudents.StudID, tblStudents.SName WHERE
tblStudents.StudID= '" & glbStudID & "'"
However, you'd get an error trying to run what you posted, so that can't be
the issue.
I suspect the issue is
DoCmd.OpenReport rptStudents, acViewPreview,,,,rst
You're trying to pass rst as the OpenArgs parameter: I believe OpenArgs must
be a text value. However, since rst is a global variable, you shouldn't need
to be passing it anyhow. Try simply using
DoCmd.OpenReport rptStudents, acViewPreview
--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)
"Tim" <T...@discussions.microsoft.com> wrote in message
news:C7247712-A814-4897...@microsoft.com...
and it does show up the report. However, at the report's Open event, the
error message, "run-time error '32585': This feature is only available in
ADP".
Private Sub Report_Open(Cancel As Integer)
Set Me.RecordSet = rst
End Sub
I did comment out these codes, then there is no error message anymore, but
the report is blank :=(. Maybe I should write a different code for the report
open event?
Since I wasn't involved with this thread from the beginning, what's the
reason for not just setting the report's RecordSource property to the SQL
that generates the recordset?
--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)
"Tim" <T...@discussions.microsoft.com> wrote in message
news:131AA2E6-E2A5-4CD9...@microsoft.com...
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Tim" <T...@discussions.microsoft.com> wrote in message
news:297E1C05-B7F6-4304...@microsoft.com...
"Douglas J. Steele" wrote:
> .
>
(Hopefully you're not trying to use wireless...)
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Tim" <T...@discussions.microsoft.com> wrote in message
news:CC9B3286-6CDD-43CD...@microsoft.com...
"Douglas J. Steele" wrote:
> .
>
Tim wrote:
>No idea what you're talking about. No, I use LAN. I guess maybe the network
>problem, i.e., the way the network guy configured the outlook for the
>security reason, so can't email from the other office application like
>Accesss ???
>
>> Flaky NIC?
>>
>[quoted text clipped - 53 lines]
>>
>> .
--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201004/1