By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,254 Members | 2,477 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,254 IT Pros & Developers. It's quick & easy.

Datareport-How to query from MS Access

P: n/a


I need to run a data report that will query an Access_Table that has the
following Project info:

My Form has a command_button with the following code:

Private Sub Command1_Click()

Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=MSDataShape;Data
PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path &
"\Access_Table.mdb;"

Set adoAge = New Recordset

adoAge.Open "SELECT CustomerName, OrderNo, Invoice_Date,
IIf([Invoice_Date]<Now()-30 And
[Invoice_DATE]>Now()-60,[Invoice_Amount],"") AS Greaterthan30,
IIf([Invoice_Date]<Now()-60,[Invoice_Amount],"") AS Greaterthan60 FROM
Cust WHERE [Invoice_Date]< Now()-30", db, adOpenStatic, adLockOptimistic

Set DataReport1.DataSource = adoAge
DataReport1.Show

End Sub

My DataReport1 has the following RptTextbox:

RptTextbox Datafield
1 CustomerName
2 OrderNo
3 Invoice_Date
4 Greaterthan30
5 Greaterthan60

Problem arise when trying to display the above report that has an error
message that says "Datafield Greaterthan30 not found"
Is this an SQL Query limitation where Invoice_Date Datafield can only be
queried once & if we have more than one Datafield
with the same fieldname (Invoice_Date) within the same Data report,the
report will fail to run? Should there be one more
New Recordset to hold a second Datafield (Invoice_Date)?

can anyone help? Thanks
From:Cady Steldyn


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.