Dynamic report field

Hello.  I would like to print a particular value in a report field based on
another field value in a table.  For example, if I have a table field called
'campus' and a report field called 'name', I'd like something like this:

  if txtCampus = 'north'
     print 'john doe' in txtName
 else
       if txtCampus = 'south'
          print 'jane doe' in txtName
       else
             print 'john smith' in txtName

I'm not sure how to accomplish this.  I couldn't seem to find anything on my
report field properties where I would code something like this.  Thanks for
any help.

Rod

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-reports/200703/1

0
upsman
3/13/2007 3:00:39 AM
access.reports 4434 articles. 0 followers. Follow

2 Replies
1367 Views

Similar Articles

[PageSpeed] 40

I am not using a query to create the report; I am creating and running the
report by reading the table directly.  The report is run when the user clicks
the "Print" button.

Damian S wrote:
>Hi, 
>
>You could simply have a field called SOMETHING in your query, let the query 
>calculate the value that should be in there, and then simply display field 
>SOMETHING on your report.
>
>eg:  select Campus, iif(Campus='North', 'John Doe', iif(Campus='South', 
>'Jane Doe', 'Invalid Campus')) as SOMETHING from tblCampus
>
>Hope this helps.
>
>Damian.
>
>> Hello.  I would like to print a particular value in a report field based on
>> another field value in a table.  For example, if I have a table field called
>[quoted text clipped - 13 lines]
>> 
>> Rod

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-reports/200703/1

0
upsman
3/14/2007 2:48:53 AM
upsman via AccessMonster.com wrote:

>Hello.  I would like to print a particular value in a report field based on
>another field value in a table.  For example, if I have a table field called
>'campus' and a report field called 'name', I'd like something like this:
>
>  if txtCampus = 'north'
>     print 'john doe' in txtName
> else
>       if txtCampus = 'south'
>          print 'jane doe' in txtName
>       else
>             print 'john smith' in txtName
>
>I'm not sure how to accomplish this.  I couldn't seem to find anything on my
>report field properties where I would code something like this.  Thanks for
>any help.


Instead of "print", just assign the string to the text box:

Select Case txtCampus
Case "north"
	txtName = "john doe"
Case "north"
	txtName = "jane doe"
Case Else
	txtName = "john smith"
End Select

That code goes in the Format event of the report section
that contains the txtName text box.

With all that said, you would be much better off if you used
a small table with the translation from campus to name.
Then the report record source query could Join the little
table to the table you are currently using.  This way you
would have no code so you wouldn't have to find and change
any code when you want to add another direction or modify a
name.

-- 
Marsh
MVP [MS Access]
0
Marshall
3/14/2007 5:29:24 AM
Reply:

Similar Artilces:

having a logo on a report...
Im trying to have a company logo at the top of my report. The problem is that I only want it when the reports "CompanyFrm" field is TSWS. My CompanyFrm field is a dropdown box in the form that places the address of the company from at the top of the report. Is there a way that when the dropdown box is TSWS it places the logo at the top of the report instead of the address? -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200706/1 To the OnPrint event of the report add the code Me.[LogoName].Visible = (Me.[ComboName] = "...

change fonts for specific fields in a report
A Great Plains report prints checks. The check amount field is too small and needs to be increased. How does one change the font of a particular field in a Great Plains report? If the report is a text report, you can't change the font. If it's a graphical report, click on the field and press <Ctrl-D>. "caincognito@yahoo.com" wrote: > A Great Plains report prints checks. The check amount field is too > small and needs to be increased. How does one change the font of a > particular field in a Great Plains report? > > If it is a text report, you...

Access report in rtf format arrives in e-mail as xls file
I have a single report (with subreports embedded) that is e-mailed every day. I have been able to successfully send this report for a couple of months as an rtf file with no problems. For some reason unbenownst to me, the report formatting now shows in the e-mail as an xls file. I do not know why this has changed and have not been able to arrive at the solution as of yet. I wondered if anyone has any ideas as to why this might be happening? Your thoughts are appreciated. How exactly do you send the report? Do you do it manually or by some code? If manually, describe the steps. ...

Reported error (0X800CC0F) the connection to the server was interrupted
I am receiving this error message on a client workstation, none of the other 4 users on the LAN are receiving this error. They are using Outlook 2002 connected through an ADSL modem. The user still can send and receive e-mails but this error message always appears. Any one have any ideas? Reported error (0X800CC0F) the connection to the server was interrupted Sean For those of you that have been getting "Sending and Receiving reported error .... connection to server was interrupted" as I have, try creating a new HTTP email account, send and receive a couple of messages from that...

XML Map
Hi all, I import XML data into a worksheet, and choose a mapping name, but I have no idea how to change the path so that it is dynamic. I've been trying to find a way to set my mapping paths to dynamic, so that when I move the folder that contains the xl file and xml files, the mapping path still works. Help :) Cheers, Grant. I'm not sure you can make it 'dynamic' per se but you can write code to change. Here's a sample of changing the bound xml document. ActiveWorkbook.XmlMaps(1).DataBinding.LoadSettings ("C:\Services Proposal.xml") -- Charles...

Where to change my own internet adress in "FROM:" field?
I am using Outlook 2003 with Exchange server. My own eMail address is presented to recipients as Aaaaa.Bbbbbb@ccccccc.com Note: mixing of capital and lower letters I want my email address completely changed to lower letters: aaaaa.bbbbbb@ccccccc.com Where in Outlook can I change this? or is this a setting in Exchange Server ? Joe This is a setting in ADUC/Exchange. I would guess that everyone is set up with the same format throughout the company. -- Kathleen Orland - MVP Outlook Outlook Tips: http://www.outlook-tips.net/ http://www.howto-outlook.com/ "Joe deAngelo" wr...

Field Service modules integrated to PDAs
We have field service modules (service call management, RMA, RTV) implemented on Great Plains 8. What options do I have so that our field technicians access this information (read or inquiry capability) over say PDA. I am looking for Microsoft and ISV options. FieldConnect's FieldACCESS solution provides this capability. For more information contact me at 949-428-1540 or c.wawrina@fieldconnect.com. Carl Wawrina FieldConnect, Inc. "Jack Tundra" wrote: > We have field service modules (service call management, RMA, RTV) > implemented on Great Plains 8. What option...

Implication of setting the Publish Task field to No
Hi all, Can anyone pls advise of what the implications are on setting the publish task field to no in terms of reporting. For example if using reports from the resource centre to review actual work by resource will non published tasks be included. Or if running a report through the OLAP cube? Further should fields like total project costs displayed in the Project Centre or OLAP reports display the total minus the non published tasks? We are currently setting a number of project tasks to publish No to simplify the timesheet experience for resources but are noting a number of ...

Report writer function/calculated field question
I have a string field that consists of a number followed by a decimal followed by 5 zeroes. The number is always a whole number so I want to remove the decimal and the 5 zeroes. However, since the field is a string, I'm struggling to find a way to do that. Does anybody have any suggestions? Thanks. Zack I would use the RW_Strip user defined function. This function will return the value of the string with all occurrences of the specified characters stripped out. So you want to strip out .00000 and retrieve the remaining value? You would pass in the string field and then the characters y...

Access 97 to Word 97- Memo Fields truncating
When I convert a Access 97 report to Word 97, some of the memo fields truncate in Word. It does not matter the size of the data in the memo field. Sometimes the data is a only a few sentices, other times a large paragraph. Other times a very large paragraph will come accross fully intacted. Thanks. Laurie wrote: -------------------- | Content-Class: urn:content-classes:message | From: "Laurie" <anonymous@discussions.microsoft.com> | Sender: "Laurie" <anonymous@discussions.microsoft.com> | Subject: Access 97 to Word 97- Memo Fields truncating | Date:...

Display/Hide a Form Control/Field Based On Another Field Value?
Hi all, I have to Combo boxes on a form. The first one I would always like users to see. The second, however, I would like hidden if the first box has certain values selected. So, if ComboBox1 has values of 1 or 2, I would like ComboBox2 to show as normal. If ComboBox1 has a value of 3, I would like ComboBox2 hidden. Is there a relatively simple way of doing this, if at all? Thanks for your help as always! --Eric You have to take care of 2 things: (1) When you move from record to record and the combo box contents changes (2) When the user changes the contents of the combo box For (1), inse...

Better reports
I want to see my sales by department, or maybe even by department and then by supplier. I also need to see what i've sold and what i've received. Does anyone have any better reports than what is in rms? Thanks, Dave Dave, We have a fantastic reporting tool. We have a new excel OLAP product that lets you slice and dice your data in Microsoft Excel. You can view sales, po's, current on hand, ect. by departments, suppliers, categories. We have a report that shows current on hand, received to date, outstanding on po's and what you've sold all in one. You can...

Reports
Sorry if this may seem an obvious question; I've recently started with CRM 3.0 and have been staring at it for too long! I have created a custom field on the case form called TimeSpent. On my journey to Utopia (to send e-mail automatically to client with Case Desc, Time Spent, Time Remaining) my immediate basic requirement is just to have TimeSpent as one of the columns. So, until I get to Utopia, I generate report - Export to Excel - click to drill down - and I have most of columns except for my custom TimeSpent! Can anyone help me Regards Did you publish your customizations? Hi F...

Move Detail on Report
Hi, I used the wizard to create a form. Everything is fine except I want to have the subtotals under the group headers but the default is for the opposite. Is there a way of 'dragging and dropping' the detail line? -- Andrew 130707 On Jul 13, 6:28 pm, Andrew <And...@discussions.microsoft.com> wrote: > Sorry, no, that didn't anser my question. When looking at the report design > I have various group headers (working) and the detail after them. I want my > detail above them - any ideas? > -- > Andrew > > "Maurice" wrote: > > Andrew,...

Incorrect mailbox size reporting Exchange 2003 SP1
Hello, we are facing a little problem with one mailbox on Exchange 2003sp1 the user reached the mailbox size limit and received the messages. however, after deleting mail (and cleaning deleted items), the mailbox size is still showing 300 mb, even though the actual size in outlook is 5 mb. for other mailboxes, it is immediate, both when size increases or decreases. the only mails left are the dumpster, but it shouldn't count on mailbox quota. Does Anybody know what i could check ? I know i can recreate another mailbox and transfer mails, but i hope there is a more 'elegant' solu...

Faulting application dynamics.exe
I am not sure what is going on but there are times when this error occurs for users in GP 7.5... "Faulting application dynamics.exe, version 7.5.0.3, faulting module mfc42.dll, version 6.0.8665.0, fault address 0x000048ab." After getting this error, GP shuts down. I have been trying to pinpoint when it does not happen in a consistent spot. It also does not happen to all users. I also can not get this error to occur on the development machine. I have researched the heck out of this on the web but have found no resolution. The only thing that I can see different is the deve...

Task 'Work
When downloading an email with an Excel attachment (I have had this happen with both '97 - 2003 and 2007 formats) I get this error: Task 'Work - Receiving' reported error (0x800CCC0F) : 'The connection to the server was interrupted. If this problem continues, contact your server administrator or Internet service provider (ISP). The mail administrator at our ISP sees no issues on his side. If I do not download with Outlook 2007 I can go into my webmail and the email is there and I can get the attachment. It also appears in my Blackberry mailbox. However, wh...

Formatting date fields after export
I am experiencing problems with my exported date fields into Excel from other applications. The data formats to "yyyy-mm-dd" and cannot be modified unless I double-click on each field. Has anyone else experienced this problem? And what solutions would you suggest? It is probably seen as text, select the imported dates, do data>text to columns, click next twice, under column data format select date and YMD click finish Regards, Peo Sjoblom "Raymond" wrote: > I am experiencing problems with my exported date fields into Excel from other > applications. The d...

Auto Filling fields in form
I am new at creating code and would like to have two fields populated when the record is reviewed. One is the user name and the other is the date reviewed. There is a form which contains the Member Name and ID number. I would like to add the two auto fill fields in the Parent form and have it fill in the subform fields for that particular member using a trigger of some sort. Any advice would be appreciated. Bev Access forms display data... Access tables store it. If you want to see data from a record in a table in your form, your controls in the form need to be poin...

need to know how to incorporate drop-down fields and lists
working w/ms word 2003, Designing my own webpage... want to incorporate both drop-down fields and drop-down lists, won"t let me put in the text i need??? Talk to me like i"m ten yrs. old.... new to this stuff. Thanks!!! ...

Virtual Fields
There are times when I want to display information that I don't want to store to the data base, it would be nice to be able to have fields added to the form that can be populated through events. These fields are nice for the User to display information if a format that they are familiar with. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft...

copy fields forward for new records.
I am trying to copy fields forward in a data entry form, so the user doesn't have to keep re-entering certain fields that usually stay the same. Anybody know how to do this? Thanks! Hi Open the form in design view and set the Default value of the control (right click the control and open the properties box to do this) Hope this helps -- Wayne Manchester, England. "ColbyS" wrote: > I am trying to copy fields forward in a data entry form, so the user doesn't > have to keep re-entering certain fields that usually stay the same. Anybody > know how to do...

convert a field format DD:HH:MM to hours & minute
I have a field formated as DD:HH:MM:ss and i need to convert the DD:HH:MM in to HH.MM using the decimal plac as the delimiter any help would be appreciated -- Message posted from http://www.ExcelForum.com ...

Please Help..Error in Financial Statement Reports
Hello all, After we finished year end closing procedure we tried to print Balance Sheet and Profit & Loss statement report but we surprised from the results.. The balances are not correct and some of the accounts didn't appeare in the report !! Although we made Reconcile, we get nothing new :( While when we print a trial balance report all the account balances are OK and we checked the closing journal it gives a correct balances ! the question is: whats the wrong in the financial statements report.. why it gives error and dosen't show sales accounts ?!! Please help. We stopp...

Custom Batch report
We are looking to get a report as follow: 1. Filter by Batch Number 2. The following columns in the report: batch #, Transaction #, Customer Name, Tender Type, Total amount. Getting sub totals by tender type is helpful addition. We will be happy to get quote for the job. Thanks. shauli@usauthentic.com Dover, We have a report that does just that. If you would like more information please email sales@rite.us. Ryan Sakry Program Manager "Dover" <Dover@discussions.microsoft.com> wrote in message news:71A52C0F-3024-4459-902B-CF41DD06C4D6@microsoft.com... > We are...