Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Posts
    47

    Unanswered: SQL to code , need help !

    I have a parameter query I want to populate a form with I have the SQL statement but can't figure out how to get the SQL to run in code . Basically I want the user to input the employeenum parameter then run the query afterupdate of the employeenum textbox . Here is the SQL :

    SELECT Clock.Clockout, Clock.EmployeeNum, Clock.CurrentDate, Clock.First, Clock.Last, Clock.Clockin, Clock.[Current Time], Clock.hoursworked, Clock.inout
    FROM Clock
    WHERE (((Clock.Clockout) Is Null) AND ((Clock.EmployeeNum)=[Enter your ID Number]) AND ((Clock.CurrentDate)=Date()));


    How do I run this in code as an afterupdate event ?

  2. #2
    Join Date
    May 2003
    Posts
    47

    screwed up the SQL ........

    the SQL should read :

    SELECT [Clock].[Clockout], [Clock].[EmployeeNum], [Clock].[CurrentDate], [Clock].[First], [Clock].[Last], [Clock].[Clockin], [Clock].[Current Time], [Clock].[hoursworked], [Clock].[inout]
    FROM Clock
    WHERE ((([Clock].[Clockout]) Is Null) And (([Clock].[EmployeeNum])=[Forms]![clockout6]![EmployeeNum]) And (([Clock].[CurrentDate])=Date()));

  3. #3
    Join Date
    May 2003
    Posts
    47

    for the benefit of others .......

    For the benefit of others , here is what worked :

    me.recordsource = ("SELECT [Clock].[Clockout], [Clock].[EmployeeNum], [Clock].[CurrentDate], [Clock].[First], " _
    & "[Clock].[Last], [Clock].[Clockin], [Clock].[Current Time], [Clock].[hoursworked], [Clock].[inout] " _
    & "FROM Clock WHERE ((([Clock].[Clockout]) Is Null) And (([Clock].[EmployeeNum])=[Forms]![clockout6]![EmployeeNum]) " _ & " And (([Clock].[CurrentDate])= #" & Date() & "#));")
    me.requery

    Placed in the afterupdate event of [EmployeeNum]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •