Senin, 27 Juli 2015

[MS_AccessPros] Re: Query for unmatched with two parameters

 

Karen

 

Using Parameters in a query is pretty straight-forward. In this example, the parameters are being pulled from an open form named frmActivitiesSearch. That's usually how such queries are done. I'm assuming Dept is text.

 

PARAMETERS [Forms]![frmActivitiesSearch]![txtActivityDate] datetime,

[Forms]![frmActivitiesSearch]![txtDept] text(255);

SELECT *
FROM tblActivities LEFT JOIN tblRepsCmbd ON
tblActivities.ActivityID_PK = tblRepsCmbd.ActivityID_FK
WHERE tblActivities.ActivityDate = [Forms]![frmActivitiesSearch]![txtActivityDate]
AND tblActivities.Dept = [Forms]![frmActivitiesSearch]![txtDept]

 

By declaring the two values as the proper data types, Access will understand what is being passed.

 

Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-64270730881E
My nothing-to-do-with-Access blog
http://wrmosca.wordpress.com

 



---In MS_Access_Professionals@yahoogroups.com, <k2j1203@yahoo.com> wrote :

Hello everyone.  I hope everyone is doing well.  I'm stuck on a query that I'm trying to create.


I want to create a query where an user can type in a date and department and have the query results be all of the sales reps that are available for that date.  I have two tables: tblActivities and tblRepsCmbd.  They are left joined on tblActivities.ActivityID_PK to tblRepsCmbd.ActivityID_FK.  The field that I want to have the user enter the date is tblActivities.ActivityDate.  The field for department is tblActivities.Dept.  The sales reps names are in tblRepsCmbd.RepName field.


Let me know if you need more information.


Thanks so much.


Karen

__._,_.___

Posted by: wrmosca@comcast.net
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

.

__,_._,___

Tidak ada komentar:

Posting Komentar