Error on changing record source

G

Guest

I am working with Access 97 and have the following code.


If GetDateBegDrillDownSales() < Date Then
strRs = "SELECT tmpPOLTToday.po_recpt_key AS PONo,
tmpPOLTToday.POReceiptDate AS " _
& "POReq, tmpPOLTToday.so_prod_key AS POProd,
tmpPOLTToday.SumOfpo_rcitm_qty AS " _
& "POQty, tblProd.ProdDesc AS PODesc FROM tblProd INNER JOIN
tmpPOLTToday ON " _
& "tblProd.UPCAdage13 = tmpPOLTToday.so_prod_key " _
& "WHERE (((tmpPOLTToday.POReceiptDate)=" & Chr(34) &
GetDateBegDrillDownSales() _
& Chr(34) & ") AND ((tmpPOLTToday.so_prod_key)=" & Chr(34) & GetUPC()
& Chr(34) _
& "));"
Else
strRs = "SELECT tmpPOGTEQToday.po_hdr_key AS PONo,
tmpPOGTEQToday.po_hdr_reqdt AS " _
& "POReq, tmpPOGTEQToday.so_prod_key AS POProd,
tmpPOGTEQToday.SumOfpo_dtl_ordqt " _
& "AS POQty, tblProd.ProdDesc AS PODesc FROM tmpPOGTEQToday INNER JOIN
tblProd " _
& "ON tmpPOGTEQToday.so_prod_key = tblProd.UPCAdage13 " _
& "WHERE (((tmpPOGTEQToday.po_hdr_reqdt)=" & Chr(34) &
GetDateBegDrillDownSales() _
& Chr(34) & ") AND ((tmpPOGTEQToday.so_prod_key)=" & Chr(34) &
GetUPC() & Chr(34) _
& "));"
End If
Me.RecordSource = strRs
Me.Requery

I am getting an error on the Me.RecordSource = strRS.

The error is 2001: You cancelled the previous operation. I am trying to set
the record source in the open event of the form. Any help would be greatly
appreciated.
 
G

Guest

I found the problem. The first parameter is a date. I needed to wrap it with
#'s instead of '.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top