I am pulling information from 3 tables to place in a recordset then print to a text file. When I scale back and only request info from 1 table, I am successful. However, when I try to pull from the 3 tables that I need, I am unsuccessful.
Here is the way the tables relate:
T20 T03 T20 T06
------------------------ -------------------
CDATTIM --> CDATTIM USERID --> USERID
RECCD --> RECCD
CRNODE --> CRNODE
CDATE --> CDATE
CTIME --> CTIME
HERE IS THE SQL STATEMENT I BUILD:
strSQL = "SELECT T20.ESTATCD, " & _
"T20.EQCD, " & _
"T20.USERID, " & _
"T20.CDATE, " & _
"T06.LNAME, " & _
"T06.FNAME, " & _
"T03.POL " & _
"FROM USERID.T20 T20 " & _
"INNER JOIN USERID.T06 T06 " & _
"ON (T20.USERID = T06.USERID) " & _
"INNER JOIN USERID.T03 T03 " & _
"ON (T20.CDATTIM = T03.CDATTIM AND " & _
"T20.RECCD = T03.RECCD AND " & _
"T20.CRNODE = T03.CRNODE AND " & _
"T20.CDATE = T03.CDATE AND " & _
"T20.CTIME = T03.CTIME) " & _
"WHERE T20.USERID = 'ANDREWS' AND " & _
"(T20.ESTATCD IN 'UWI', 'UWC', 'DEC') " & _
"ORDER BY T03.POL ASC "
The statement above does not get any SQL syntax errors, it goes to the database, but when it comes back and I check the status of the recordset, it is 0 (closed). When I go back to pulling from 1 table, the recordset status is 1.
Does anyone have any ideas what I am doing wrong. I have gone through books and asked many co-workers without any luck. I also tried creating a Crystal Report using Select Expert...that worked. I also tried linking the tables in an Access Database and trying to do a query...that worked on 1 table, but not multiple.
Thanks in advance for any help.
JBEALE
Here is the way the tables relate:
T20 T03 T20 T06
------------------------ -------------------
CDATTIM --> CDATTIM USERID --> USERID
RECCD --> RECCD
CRNODE --> CRNODE
CDATE --> CDATE
CTIME --> CTIME
HERE IS THE SQL STATEMENT I BUILD:
strSQL = "SELECT T20.ESTATCD, " & _
"T20.EQCD, " & _
"T20.USERID, " & _
"T20.CDATE, " & _
"T06.LNAME, " & _
"T06.FNAME, " & _
"T03.POL " & _
"FROM USERID.T20 T20 " & _
"INNER JOIN USERID.T06 T06 " & _
"ON (T20.USERID = T06.USERID) " & _
"INNER JOIN USERID.T03 T03 " & _
"ON (T20.CDATTIM = T03.CDATTIM AND " & _
"T20.RECCD = T03.RECCD AND " & _
"T20.CRNODE = T03.CRNODE AND " & _
"T20.CDATE = T03.CDATE AND " & _
"T20.CTIME = T03.CTIME) " & _
"WHERE T20.USERID = 'ANDREWS' AND " & _
"(T20.ESTATCD IN 'UWI', 'UWC', 'DEC') " & _
"ORDER BY T03.POL ASC "
The statement above does not get any SQL syntax errors, it goes to the database, but when it comes back and I check the status of the recordset, it is 0 (closed). When I go back to pulling from 1 table, the recordset status is 1.
Does anyone have any ideas what I am doing wrong. I have gone through books and asked many co-workers without any luck. I also tried creating a Crystal Report using Select Expert...that worked. I also tried linking the tables in an Access Database and trying to do a query...that worked on 1 table, but not multiple.
Thanks in advance for any help.
JBEALE