Make table query not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Basenji3
    New Member
    • Mar 2014
    • 14

    #1

    Make table query not working

    I have a query from which I would like to make a table named 18H. When I run this along with some other queries as an event procedure, it does not work. If I run it manually, it works fine.

    Not sure what's happening; I do have some criteria where it makes sure it picks the correct data by stating this time is between a start and end time on the other table.


    Code:
    SELECT [SP-Pick].DDate, [SP-Pick].EmpNo, [SP-Pick].TTime, [tbl Emp Data].[Job#], [tbl Emp Data].Task, [tbl Emp Data].Start, [tbl Emp Data].End INTO 18h
    FROM [SP-Pick] INNER JOIN [tbl Emp Data] ON ([SP-Pick].EmpNo = [tbl Emp Data].[Emp$]) AND ([SP-Pick].DDate = [tbl Emp Data].AdjustedDate)
    WHERE ((([tbl Emp Data].Task) Is Not Null) AND (([tbl Emp Data].Start)<[Sp-Pick]![TTime]) AND (([tbl Emp Data].End)>[SP-Pick]![TTime]));
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    You tell us it doesn't work without giving any details of what happens.

    If you're seriously after some help then may I suggest you give some little thought to your question.

    Comment

    • PhilOfWalton
      Recognized Expert Top Contributor
      • Mar 2016
      • 1430

      #3
      As usual I agree with Neopa - lack of information, but I would be very suspicious of the # in Job#, and I'm not over happy about the minus sign is say SP-Pick. I suggest JobNo and use an underscore instead of the minus. End is a reserved word, so I would either change it or put square brackets round it.

      The above is all guess work

      Have you pasted your SQL from your VBA back into a query to see if that gives an error?

      Phil

      Comment

      Working...