I'm having problems querying access database 
Author Message
 I'm having problems querying access database

I think your problem is in the date portion of your sql. Try"

& "(Interview.interviewdate = #" & CDate(intdate) & "#" _

  >  I have been trying to query a database in vb4 and I am having
  >problems.  When I execute this code it comes back with an empty
  >dynaset?  (there is data in the table with the date in question)  I
  >have solved the problem before, but for lack of a brain I did not file
  >the answer anywhere.  Could someone help explain what I'm doing wrong
  >and how to fix it??  Please?   A troubled newbie!
  >
  >CODE:
  >Dim intdate As Date
  >
  >intdate = #5/7/97#
  >
  >Data1.RecordSource = ("SELECT DISTINCTROW Interview.interviewdate,
  >Interview.interviewtime, " _
  >& "Contacts.Firstname, Contacts.Lastname FROM Contacts INNER JOIN
  >Interview ON " _
  >& "Contacts.contactid = Interview.contactid Where " _
  >& "(Interview.interviewdate =" & CDate(intdate) & "" _
  >& ")ORDER BY Interview.interviewtime")
  >
  >



Wed, 27 Oct 1999 03:00:00 GMT  
 I'm having problems querying access database

  I have been trying to query a database in vb4 and I am having
problems.  When I execute this code it comes back with an empty
dynaset?  (there is data in the table with the date in question)  I
have solved the problem before, but for lack of a brain I did not file
the answer anywhere.  Could someone help explain what I'm doing wrong
and how to fix it??  Please?   A troubled newbie!

CODE:
Dim intdate As Date

intdate = #5/7/97#

Data1.RecordSource = ("SELECT DISTINCTROW Interview.interviewdate,
Interview.interviewtime, " _
& "Contacts.Firstname, Contacts.Lastname FROM Contacts INNER JOIN
Interview ON " _
& "Contacts.contactid = Interview.contactid Where " _
& "(Interview.interviewdate =" & CDate(intdate) & "" _
& ")ORDER BY Interview.interviewtime")



Wed, 27 Oct 1999 03:00:00 GMT  
 I'm having problems querying access database



Quote:
>   I have been trying to query a database in vb4 and I am having
> problems.  When I execute this code it comes back with an empty
> dynaset?  (there is data in the table with the date in question)  I
> have solved the problem before, but for lack of a brain I did not file
> the answer anywhere.  Could someone help explain what I'm doing wrong
> and how to fix it??  Please?   A troubled newbie!

> CODE:
> Dim intdate As Date

> intdate = #5/7/97#

> Data1.RecordSource = ("SELECT DISTINCTROW Interview.interviewdate,
> Interview.interviewtime, " _
> & "Contacts.Firstname, Contacts.Lastname FROM Contacts INNER JOIN
> Interview ON " _
> & "Contacts.contactid = Interview.contactid Where " _
> & "(Interview.interviewdate =" & CDate(intdate) & "" _
> & ")ORDER BY Interview.interviewtime")

If the field is a Date/Time field, it might have the date but ther might be
a time associated.  so 5/7/97 <> 5/7/97 12:01 am.  The serial value for
each is different.  5/7/97 is the same as 5/7/97 12:00 am.

Also if 'intdate' is declared as a date var, why are you converting it to a
date

--
JD

** When all else fails, RTFM



Fri, 29 Oct 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Having problems with SIMPLE query in VB 6 and Access XP, Please Help

2. Newbiw having problems with Permanent QueryDef: Query input must contain at least one table or query

3. Problem's accessing multi-user Access'97 database from within MTS

4. Recordsource - Can't find a Query in Access Database with VB5

5. Problem in creating a query joinning 3 tables having 1-many relationship

6. Is Having Multiple Access Databases better than Having one big Access Database?

7. Is Having Multiple Access Databases better than Having one big Access Database?

8. Problems querying MS-Access database

9. ASP/VBScript query problem for an Access database...

10. I'm having a problem with a 'special' character in a query

11. I'm having a problem with a date variable

12. I'm having a problem using the MSComm control I hope someone can help

 

 
Powered by phpBB® Forum Software