RunTime 3075, cant see the problem? And Values are as they should be...

Reply

Join Date: Oct 2006
Posts: 2
Reputation: snaged46 is an unknown quantity at this point 
Solved Threads: 0
snaged46 snaged46 is offline Offline
Newbie Poster

RunTime 3075, cant see the problem? And Values are as they should be...

 
0
  #1
Oct 2nd, 2006
Hello everyone,

This is my first post on this board, I have a problem that I cant find any answers for on the web. I have a Private sub on a form, and I have sql code that draws the information that I want, but does not work when I try to set up a definition because I get the run Time error 3075. How Come? It gives me back the line of SQL code that is in the WHERE clause, [TableStudyHallHoursDetail].[Name] In (SELECT [Name] FROM [TableStudyHallHoursDetail] As Tmp GROUP BY [Name],[Date],[InTime] HAVING Count(*)>1 [Name]='" & Me!TextName & "' And [Date] ='" & Format(Me.TextDate, "\#mm\/dd\/yy\#") & "' And [InTime] ='" & Me!TextInTime & "')

Here is my code in VBA:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub TextInTime_AfterUpdate()
  2. Dim db As Database
  3. Dim rst As Recordset
  4. Dim strSQL As String
  5. Dim qdf As QueryDef
  6.  
  7.  
  8. Set db = CurrentDb()
  9. strSQL = "SELECT TableStudyHallHoursDetail.[Name], TableStudyHallHoursDetail.[Date], TableStudyHallHoursDetail.[InTime], TableStudyHallHoursDetail.[HourID], TableStudyHallHoursDetail.[OutTime], TableStudyHallHoursDetail.[AuditTime]" & _
  10. "FROM [TableStudyHallHoursDetail]" & _
  11. "WHERE [TableStudyHallHoursDetail].[Name] In (SELECT [Name] FROM [TableStudyHallHoursDetail] As Tmp GROUP BY [Name],[Date],[InTime] HAVING Count(*)>1 [Name]='" & Me!TextName & "' And [Date] ='" & Format(Me.TextDate, "\#mm\/dd\/yy\#") & "' And [InTime] ='" & Me!TextInTime & "')" & _
  12. "ORDER BY TableStudyHallHoursDetail.Name, TableStudyHallHoursDetail.Date, TableStudyHallHoursDetail.InTime;"
  13.  
  14.  
  15. Set rst = db.OpenRecordset(strSQL, dbOpenSnapshot)
  16. With db
  17. Set qdf = .CreateQueryDef("tmpDuplicates", sSQL)
  18. DoCmd.OpenQuery "tmpDuplicates"
  19. .QueryDefs.Delete "tmpDuplicates"
  20. End With
  21. db.Close
  22. qdf.Close
  23.  
  24.  
  25. End Sub

Once, I ran a debug.printSQL statement and it came back as
SELECT TableStudyHallHoursDetail.[Name], TableStudyHallHoursDetail.[Date], TableStudyHallHoursDetail.[InTime], TableStudyHallHoursDetail.[HourID], TableStudyHallHoursDetail.[OutTime], TableStudyHallHoursDetail.[AuditTime]FROM TableStudyHallHoursDetailWHERE (((TableStudyHallHoursDetail.Name) In (SELECT [Name] FROM [TableStudyHallHoursDetail] As Tmp GROUP BY [Name],[Date],[InTime] HAVING Count(*)>1 [Name]='Smith, Bill' And [Date] =#9/27/2006# And [InTime] =6:00:00 PM)))ORDER BY TableStudyHallHoursDetail.Name, TableStudyHallHoursDetail.Date, TableStudyHallHoursDetail.InTime;

So it seems like the information is being drawn from the table! ARRRGH

Any help would be greatly appreciated!
Thanks!
Last edited by Comatose; Oct 3rd, 2006 at 5:51 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC