Results 1 to 5 of 5

Thread: New To SQL? Type Mismatch

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Lost in the Mojave Desert
    Posts
    82

    Unhappy


    getting type mismatch very new to sql any help would be appreciated oh ssql1$,2,sdate$ to and sdatefrom$

    sSQL1 = "SELECT * FROM [Service Calls] WHERE [Date] BETWEEN" & "#" & sDateFrom & "#" And "#" & sDateTo & "#" & "ORDER BY Date,ORDER BY Time"
    sSQL2 = "SELECT * FROM [Cust Info] WHERE [Cust ID] =" & apptRSResult![Cust ID]

    Set apptRSResult = mdiDBMain.objDataBase.OpenRecordset(sSQL1, dbOpenDynaset) 'new rs from sdatefrom to sdateto
    Set apptRSPrint = mdiDBMain.objDataBase.OpenRecordset(sSQL2, dbOpenDynaset) 'locate all records with same custid number

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    try:

    sSQL1 = "SELECT * FROM [Service Calls] WHERE [Date] BETWEEN #" & sDateFrom & "# And #" & sDateTo & "# ORDER BY Date, Time"
    sSQL2 = "SELECT * FROM [Cust Info] WHERE [Cust ID] ='" & apptRSResult![Cust ID] & "'"

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Lost in the Mojave Desert
    Posts
    82

    ?

    the first sql statement worked but i think that the approach on the second was incorrect on my part, what im looking to do is get every record in one table that matches every record in the rs that is created with sSQL1, i was thinking maybe of looping thru the recordset and searching, do you know of another way useing sql?

  4. #4
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    No problem. Try:


    sSQL2 = "SELECT * FROM [Cust Info] WHERE [Cust ID] in( SELECT [Cust ID] FROM [Service Calls] WHERE [Date] BETWEEN #" & sDateFrom & "# And #" & sDateTo & "# )"

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Lost in the Mojave Desert
    Posts
    82

    !

    tnx, do you recommend any specific book for learning sql?

Posting Permissions

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



Click Here to Expand Forum to Full Width