Senin, 02 Januari 2012

RE: [MS_AccessPros] Re: Print a listbox from a form, the list box is dynamic

 

Terence-

You can change the Record Source of a Report in the Open event, but not the Load
event.

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Waco, Texas <yee haw>)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Terence
Sent: Monday, January 02, 2012 12:12 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Re: Print a listbox from a form, the list box is
dynamic

Thanx Patrick, I am close , but not 100%.
in the report On_load event i placed

Me.RecordSource = Forms!frm_roster.mysql

It works, problem is I cannot print the report because i get the error msg 2129
saying i cannot change the recordsource after a report is started or in preview.

I tried to move the code to change rs into the form, but that didn't work
either??? Hmm

I will keep experimenting...Suggestions ?
Terence

--- In MS_Access_Professionals@yahoogroups.com, "patrickawood" <pwood57@...>
wrote:
>
> Hi Terence,
>
> I think a Report is a good solution. You can easily change the RecordSource of
a report with code.
>
> strSQL = "Your Query SQL or Query or Table name here"
>
> Reports!MyReport.RecordSource = strSQL
> Reports!MyReport.Requery
>
> Or if you place the code in the Report:
>
> Me.RecordSource = strSQL
> Me.Requery
>
> Kind Regards,
> Patrick Wood
> Microsoft Access MVP
> Gaining Access Technologies Founder
> http://gainingaccess.net
> Microsoft Access and SQL Azure Information Center for Developers:
> http://gainingaccess.net/SQLAzure/AccessAndSQLAzureInfo.aspx
>
>
> --- In MS_Access_Professionals@yahoogroups.com, "Terence" <buffalome90210@>
wrote:
> >
> > I have a form with a listbox.
> > The listbox gets populated dynamically, I change it's source, for things
like sort options, and criteria between dates.
> >
> > I can't use a screen print because the box content may be larger then
visible, i.e. vertical scroll bar.
> >
> > only thing i can think of is a generic report and change its source, but I
am not sure how to change the recordsource dynamically for a report....
> >
> > suggestions on how to print this listbox, and/or how to change RS of the
report ?
> > terence
> >
>

------------------------------------

Yahoo! Groups Links

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar