Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / January 2005

Tip: Looking for answers? Try searching our database.

Update Form Recordsource Crosstab Query while in form....

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MikeZz - 27 Jan 2005 22:55 GMT
I have the following crosstab query called [BuyerIn] which is the
recordsource for my form.  The purpose of the query is to show the best time
to call my buyers back.  It counts how many times I got a hold of them in my
call log table and groups by hour of the day.

What I would like to do is have a button on the form that will update the
form to show when the worst time to call is.  Either by changing the
recordsource query to another query with BuyerAtDesk = False, or somehow code
it in sql.  I have tried using a parameter in that criteria and linking it to
the grpButtons but have not had any sucess getting it to work in my form.

So, is there a way to change the record source to another query?
Or hard-code the query to run when opening the form?

Thanks,
MikeZz

WHERE (((Buyers.BuyerFilter)=True) AND ((ContactType.BuyerAtDesk)=FALSE))

TRANSFORM Count(Hour([CallLog]![LogTime])) AS Expr1
SELECT DatePart("h",[LogTime]) AS [Order], Format(([LogTime]),"h am/pm") AS
Hours
FROM ContactType INNER JOIN (Buyers INNER JOIN CallLog ON Buyers.BuyerID =
CallLog.BuyerID) ON ContactType.ContactTypeID = CallLog.CallType
WHERE (((Buyers.BuyerFilter)=True) AND ((ContactType.BuyerAtDesk)=True))
GROUP BY DatePart("h",[LogTime]), Format(([LogTime]),"h am/pm"),
Buyers.BuyerFilter, ContactType.BuyerAtDesk
ORDER BY DatePart("h",[LogTime])
PIVOT Buyers.ShortName;
visdev1 - 28 Jan 2005 18:03 GMT
you can set the recordsource property to your first query which will show
when you open the form.  Then put this code under a commandbutton to switch
queries. Or you can just put this code under the form's On Open event and let
it set the recordsource when it runs.
Like this:

Private Sub Form_Open(Cancel As Integer)

Me.RecordSource = "qryCross2"

'or if you want to change another form's recordsource you use
'form_<name of form>.RecordSource = ...

Form_Form1.RecordSource = "qryCross2"

End Sub

> I have the following crosstab query called [BuyerIn] which is the
> recordsource for my form.  The purpose of the query is to show the best time
[quoted text clipped - 25 lines]
> ORDER BY DatePart("h",[LogTime])
> PIVOT Buyers.ShortName;
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.