-
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
-
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] & "'"
-
?
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?
-
No problem. Try:
sSQL2 = "SELECT * FROM [Cust Info] WHERE [Cust ID] in( SELECT [Cust ID] FROM [Service Calls] WHERE [Date] BETWEEN #" & sDateFrom & "# And #" & sDateTo & "# )"
-
!
tnx, do you recommend any specific book for learning sql?