T
Tony Girgenti
Hello,
I started working with Allen Browne on this problem, but i haven't heard
from him in a couple of days, so i thought i might try this forum for a
solution.
I'm try to produce a report on externally linked ODBC tables using the where
condition at the end.
The problem is with the lines that have "sa_hdr.post_dat" in them.
"sa_hdr.post_dat" is a date field in the table formatted as text "yyyymmdd".
The form dates are formatted as short date. The same condition is used to
create a record set and it works fine. It gives me the exact records that i
want.
However, when it is used in the docmd.openreport, it does not give any
records, just a blank page. I have tried numerous ways to format the
"sa_hdr.post_dat".
Any help appreciated.
Thanks,
Tony
RptQry = "(sa_lin.item_no >= '" & [Forms]![Form1]![StrItm] & "' " & _
"OR " & [Forms]![Form1]![StrItmChk] & " = True) " & _
"AND (sa_lin.item_no <= '" & [Forms]![Form1]![EndItm] & "' "
& _
"OR " & [Forms]![Form1]![EndItmChk] & " = True) " & _
"AND (sa_hdr.post_dat >= '" &
Format([Forms]![Form1]![StrDat], "yyyymmdd") & "' " & _
"OR " & [Forms]![Form1]![StrDatChk] & " = True) " & _
"AND (sa_hdr.post_dat <= '" &
Format([Forms]![Form1]![EndDat], "yyyymmdd") & "' " & _
"OR " & [Forms]![Form1]![EndDatChk] & " = True) " & _
"AND (cust.zip_cod >= '" & [Forms]![Form1]![StrZip] & "' " &
_
"OR " & [Forms]![Form1]![StrZipChk] & " = True) " & _
"AND (cust.zip_cod <= '" & [Forms]![Form1]![EndZip] & "' " &
_
"OR " & [Forms]![Form1]![EndZipChk] & " = True) " & _
"AND (cust.bal >= " & [Forms]![Form1]![StrSalAmt] & " " & _
"OR " & [Forms]![Form1]![StrSalAmtChk] & " = True) " & _
"AND (cust.bal <= " & [Forms]![Form1]![EndSalAmt] & " " & _
"OR " & [Forms]![Form1]![EndSalAmtChk] & " = True) " & _
"AND (cust.cat = '" & [Forms]![Form1]![CusCat] & "' " & _
"OR " & [Forms]![Form1]![CusCatChk] & " = True) " & _
"AND ((" & [Forms]![Form1]![ExcCustChk] & " = false) " & _
"or (" & [Forms]![Form1]![ExcCustChk] & " = true and
cust.email_adrs > ' ')) "
DoCmd.OpenReport "cust3", acPreview, , RptQry
I started working with Allen Browne on this problem, but i haven't heard
from him in a couple of days, so i thought i might try this forum for a
solution.
I'm try to produce a report on externally linked ODBC tables using the where
condition at the end.
The problem is with the lines that have "sa_hdr.post_dat" in them.
"sa_hdr.post_dat" is a date field in the table formatted as text "yyyymmdd".
The form dates are formatted as short date. The same condition is used to
create a record set and it works fine. It gives me the exact records that i
want.
However, when it is used in the docmd.openreport, it does not give any
records, just a blank page. I have tried numerous ways to format the
"sa_hdr.post_dat".
Any help appreciated.
Thanks,
Tony
RptQry = "(sa_lin.item_no >= '" & [Forms]![Form1]![StrItm] & "' " & _
"OR " & [Forms]![Form1]![StrItmChk] & " = True) " & _
"AND (sa_lin.item_no <= '" & [Forms]![Form1]![EndItm] & "' "
& _
"OR " & [Forms]![Form1]![EndItmChk] & " = True) " & _
"AND (sa_hdr.post_dat >= '" &
Format([Forms]![Form1]![StrDat], "yyyymmdd") & "' " & _
"OR " & [Forms]![Form1]![StrDatChk] & " = True) " & _
"AND (sa_hdr.post_dat <= '" &
Format([Forms]![Form1]![EndDat], "yyyymmdd") & "' " & _
"OR " & [Forms]![Form1]![EndDatChk] & " = True) " & _
"AND (cust.zip_cod >= '" & [Forms]![Form1]![StrZip] & "' " &
_
"OR " & [Forms]![Form1]![StrZipChk] & " = True) " & _
"AND (cust.zip_cod <= '" & [Forms]![Form1]![EndZip] & "' " &
_
"OR " & [Forms]![Form1]![EndZipChk] & " = True) " & _
"AND (cust.bal >= " & [Forms]![Form1]![StrSalAmt] & " " & _
"OR " & [Forms]![Form1]![StrSalAmtChk] & " = True) " & _
"AND (cust.bal <= " & [Forms]![Form1]![EndSalAmt] & " " & _
"OR " & [Forms]![Form1]![EndSalAmtChk] & " = True) " & _
"AND (cust.cat = '" & [Forms]![Form1]![CusCat] & "' " & _
"OR " & [Forms]![Form1]![CusCatChk] & " = True) " & _
"AND ((" & [Forms]![Form1]![ExcCustChk] & " = false) " & _
"or (" & [Forms]![Form1]![ExcCustChk] & " = true and
cust.email_adrs > ' ')) "
DoCmd.OpenReport "cust3", acPreview, , RptQry