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

Report Headache

P: 1
Using Access 2003 on Windows XP SP2

I have a report based on a query. It's meant to display a complete order, which is based on two tables, “Proposals” and “Orders”. In the proposal table, I quote “Sold As” prices as follows: Purchase, Lease or Reprogram.

When the final order is placed, the price is one of the three. On the report, “Complete Order”, I'd like to have an unbound text field that displays the price based on the value of the “Sold As” field.

I assume it's some kind of Select Case or If, Then, Else… and DLookup combination, but I can figure out the code. Basically, I want the report to run something like:

If [Report Field] Sold As = Lease then [Report Unbound Field] Price should show [Proposal Table Field] Lease

If [Report Field] Sold As = Purchase then [Report Unbound Field] Price should show [Proposal Table Field] Purchase

Otherwise [Report Unbound Field] Price should show “N/A”
Aug 8 '07 #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,389
Do it through a query instead and bind the report to the query.
Aug 20 '07 #2

ADezii
Expert 5K+
P: 8,669
Using Access 2003 on Windows XP SP2

I have a report based on a query. It's meant to display a complete order, which is based on two tables, “Proposals” and “Orders”. In the proposal table, I quote “Sold As” prices as follows: Purchase, Lease or Reprogram.

When the final order is placed, the price is one of the three. On the report, “Complete Order”, I'd like to have an unbound text field that displays the price based on the value of the “Sold As” field.

I assume it's some kind of Select Case or If, Then, Else… and DLookup combination, but I can figure out the code. Basically, I want the report to run something like:

If [Report Field] Sold As = Lease then [Report Unbound Field] Price should show [Proposal Table Field] Lease

If [Report Field] Sold As = Purchase then [Report Unbound Field] Price should show [Proposal Table Field] Purchase

Otherwise [Report Unbound Field] Price should show “N/A”
What you are requesting can typically be done in the Format() Event of the Detail Section:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  2. Select Case Me![Sold As]
  3.   Case "Purchase"
  4.     Me![txtUnbound] = "some string"
  5.   Case "Lease"
  6.     Me![txtUnbound] = "some string"
  7.   Case "Reprogram"
  8.     Me![txtUnbound] = "some string"
  9.   Case Else
  10.     Me![txtUnbound] = "N/A"
  11. End Select
  12. End Sub
Aug 26 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.