|
-
Aug 17th, 2000, 12:40 PM
#1
Thread Starter
Lively Member
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
-
Aug 17th, 2000, 12:46 PM
#2
Frenzied Member
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] & "'"
-
Aug 17th, 2000, 12:59 PM
#3
Thread Starter
Lively Member
?
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?
-
Aug 17th, 2000, 01:12 PM
#4
Frenzied Member
No problem. Try:
sSQL2 = "SELECT * FROM [Cust Info] WHERE [Cust ID] in( SELECT [Cust ID] FROM [Service Calls] WHERE [Date] BETWEEN #" & sDateFrom & "# And #" & sDateTo & "# )"
-
Aug 17th, 2000, 01:33 PM
#5
Thread Starter
Lively Member
!
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|