Add text to a field based on a combo box selection

I'm making a form that contains a dropdown field (dropdown1) containing 5 
possible selections. Based upon what the user selects, I want to fill a 
second field (text3) with a corresponding value. 

For instance:
If dropdown1="Maintenance" then enter "Jack Doe" text3
If dropdown1="Safety" then enter "Tom Collins" text 3
etc.

Is there a way to write a 'if then else' formula in a 'calculate' form field?
And if so what would the syntax be?

Or is there a better (easier, non-programatic) way to accomplish this?

I'm not a programmer and while I'm learning, I struggle with formula syntax.

Thanks,
Dan


Thanks 
0
Utf
3/18/2010 5:06:02 PM
word.vba.general 1023 articles. 1 followers. Follow

1 Replies
1498 Views

Similar Articles

[PageSpeed] 40

You can write an IF field (but not a form field) that works that way, but it 
will be pretty complicated because you'd need to nest fields five deep to 
handle all the choices in the dropdown. A better solution is to write an 
exit macro for the dropdown that fills the text field.

See http://gregmaxey.mvps.org/Linked_DropDown_Fields.htm. The macro that 
follows the text "Note:  If you simply want to set the value of a single 
text field..." is an example of the kind of macro you need to write.

-- 
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so 
all may benefit.

dancattransit wrote:
> I'm making a form that contains a dropdown field (dropdown1)
> containing 5 possible selections. Based upon what the user selects, I
> want to fill a second field (text3) with a corresponding value.
>
> For instance:
> If dropdown1="Maintenance" then enter "Jack Doe" text3
> If dropdown1="Safety" then enter "Tom Collins" text 3
> etc.
>
> Is there a way to write a 'if then else' formula in a 'calculate'
> form field? And if so what would the syntax be?
>
> Or is there a better (easier, non-programatic) way to accomplish this?
>
> I'm not a programmer and while I'm learning, I struggle with formula
> syntax.
>
> Thanks,
> Dan
>
>
> Thanks 


0
Jay
3/18/2010 5:24:52 PM
Reply:

Similar Artilces:

check box #3
I want to put some check boxes on my worksheet. When the boxes are checked I want them to be totaled at the end of the column. I inserted the check boxes but when I put the formulas for the sum of the columns I get an error message. I am guessing that I have to make a positive check box = the value of one. Don't have a clue on how to do it. Any help would be appreciated. Dennis You can set up a linked cell for each of the checkboxes. The way you do that depends on the type of checkbox you used. If you used a checkbox from the Forms toolbar, rightclick on it and choose Forma...

field no show
The following query does not show the ID field. This is imperative because data change is dependent upon this field showing. select member_time.id, member_time.date, member_time.timein, member_time.timeout from member_time where member_time.date = #4/16/2010# This is written in a access database. Thanks That's strange. Maybe it's hidden? Try this: SELECT member_time.id, member_time.date, member_time.timein, member_time.timeout, member_time.id as TheID FROM member_time WHERE member_time.date = #4/16/2010# ; If that doesn't work, try this: SELEC...

Calculated field in pivot table #4
I'm running Excel 2002. I'm unable to create a calculated field in a pivot table. I right-clicked on a cell in the table but I don't get the "Insert Calculated Field" window on my drop-down list. Do I need an Add-On? Am I doing something wrong? Thanks for any help. On the PivotTable toolbar, choose PivotTable>Formulas>Calculated Field Dan wrote: > I'm running Excel 2002. I'm unable to create a calculated field in a pivot > table. I right-clicked on a cell in the table but I don't get the "Insert > Calculated Field" window on my ...

Add Word and change format
1) Let say colomn A is a product codes, such as "PK0021", "UQ05P8", etc...Now I want add a "Z" in front the codes. To be "ZPK0021, ZUQ05P8". What's the faster way in case I got thousand of codes? 2) In my colomn B is such code as "18-521-65, 18-81-84, 18-1112-65" and etc. Now I would like to make it to be standard to 4 digit for the middle number to be "18-0521-65, 18-0081-84, 18-1112-65" ... As the same senario as above, I got more than thousand of such codes... What's the faster way? Kelvin The first could be done wi...

Complex (for me) checking values in fields to perform calcs in others
Hi all.. I am creating a Cash Flow Projection report in access that inspects the "completed dates" of sheduled draws to calculate a remaining balance, but I am having problems with it. The idea is: --------------------- Iff [Draw1CompletedDate] = Null then Me!txtBalance = [MortgageAmount] Else If [Draw1CompletedDate] <> Null AND [Draw2CompletedDate] = Null then Me!txtBalance = [MortgageAmount] - [Draw1Amount] Else If [Draw1CompletedDate] <> Null AND [Draw2CompletedDate] <> Null AND [Draw3CompletedDate] = Null then Me!txtBalance = [MortgageAmount] - [Draw1Amoun...

How to join date/time field when "days" are same but "time" differ
Good evening everyone, I have one TRANSACTION table that contains: 1."date/time" field (YYMMDD hh:mm:ss) 2."quantity field" And another PRICE table that contans: 1."date/time" field (YYMMDD hh:mm:ss) 2."price field" Now, I want to join the "date/time" fields so I can perform a simple "quantity * price" calculation on each transaction-row. But the time differes (hh:mm:ss) and I just can't find a way to make Access accept a relation between the days (it outputs nothing). How can I make it ignore difference in the "ti...

Text to dates
I have a column of dates F6:F148, the dates have been entered in the following formats all entered as text "21.01.2009","21.1.2009","21 Jan 09" & "21 Jan 2009". I'd like to be able to change them all into a common date format 21 Jan 09 (I'll also change the sheet so that data is validated to this date format) Does anyone know a way I can do this? Thanks You can use the 'Convert Text to Columns Wizard to convert the dates --Select the range of dates which needs to be corrected. --From menu Data>'Text to Col...

zoom on RTF text
Hi all, I am currently developing a windowless textbox object using ITextServices. Everything went very well until performed zoom on text. In my code the RTF text is rendered using TxDraw, which calculates zoom factor as this: zoom factor = (pixel height of client rect)*2540/[Himetric vertical extent]*[pixel per vertical inch]. But the result wasn't really that good, the scaled text often went out of box, and word wrap wasn't consistent specially when it scaled below 60%(above 100% much better). Does anybody know what problems caused it? Any input would be appreciated. Thanks. jm H...

VBA to call file based on date
Hello, I wonder if anyone can help me with a VBA routine to check for the presence of a specific file. The file is saved on a dialy basis in the format "userfile_run_YYYYMMDD.xls" i am seeking help with a vb code that will check if today or any specified days report is generated. i guess excel can use the date format to read the specified location for the file. Thank you in advance for your help. .....Coming from Where I'm from. Dim sFile As String sFile = Dir("C:myPath\userfile_run_" & Format(Date,"yyyymmdd") & ".xls") If s...

Cannot select a range of text
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel I am unable to select a range of text with either the track pad or my mouse. I am able to double- or triple-click to select, and can use keyboard commands to select all, etc. <br><br>This is a new problem that has not existed before. <br><br>Thanks! <br><br>Art Hi Arthur: Not enough information to answer. Please carry out some diagnostic testing for us: 1) Is this one document, several documents, or all documents? 2) Is this both .doc and .docx? If not, which ...

How do I change the text size in a drop down box
I am using excel 2003. It seems to default to 10pts. Changing the size in the source list or the default in the general tab did not change the size. ...

Can I use VBA to add cells (over blanks) then do multiplication
I have a Word table in which the last column contains numbers (3 and 4) and some bank cells and I want it add them and put the total into the second last row (7 in this case). The last row contains a multiplier (3) which when applied to the total results in 21. Below is the table. | | | 3 | | | | | | | | 4 | | | | 7 | | | 3 |21| How can I achieve this in VBA (under Word 2003 and 2007) remembering that the user can add rows to the table and the last column can contain blank cells. Thanks in advance for any assistance, Peter Evans Sub ScratchMaco(...

Select Case help needed
I'm using a Select Case statement to check the value of 24 checkboxes on a form. If true for each case, run the related query. It seems to be running the first query it comes to and not continuing to check the rest. Below is sample code for the first 4 checkboxes. Can anyone help? Select Case True Case Me.chkQCT01.value = True DoCmd.OpenQuery "AccessMWapp", acNormal, acEdit Case Me.chkQCT02.value = True DoCmd.OpenQuery "AccessSEapp", acNormal, acEdit Case Me.chkQCT03.value = True DoCmd.OpenQuery "AccessSWapp", acNormal...

How to add a host in safe sender list
Dear ALL, How can i config IMFv2 to unblock all emails sent from a specific host in my company? eg. all emails sent from 10.0.0.1 should not be blocked. Thanks a lot - Add it to the Connection Filtering - Global Accept list: Global Settings | Message Delivery properties | Connection Filtering | Accept. - Enable Connection Filtering in SMTP virtual server properties | General tab | Advanced | select IP(s) | Edit | Apply Connection Filter. -- Bharat Suneja MVP - Exchange www.zenprise.com NEW blog location: www.exchangepedia.com/blog ---------------------------------------------- "...

Problem with Text box and Background
I am using the background as a temple for a form I add test boxes where I want to have text typed in The problem is when I print the page the text I have typed in isn't where it is supposed to be It is below the line of the background form How do I solve this problem? Web page? Best asked in the publisher.webdesign group -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "News" <gmhull@sbcglobal.net> wrote in message news:pOKFf.27487$F_3.19174@newssvr29.news.prodigy.net... >I am using the background as a t...

Selecting sub-folders
How do I select multiple sub-folders for moving at the same time? Rather than doing it one by one? Thanks mswart wrote: > How do I select multiple sub-folders for moving at the same time? Rather than > doing it one by one? > > Thanks Just like you do and have done in Windows Explorer: drag the parent folder and all the child folders tag along. ...

VBA to add and remove text within cells
Hi, I have a field named "Postal" at the top of column F that always include a number with 5 digits then a city name then a region name, such as "11090 CARCASSONNE Linguadoca-Rossiglione". I need to create a program to have this field changed as following : "F-11090", then copying "CARCASSONNE" into the City field which is empty (column G). The city name is always starting just one space character after the postcode, same thing for the region name, it always starts one space character after the city name. The region has to be removed completely. ...

text boxes that label axes in line/scatter graphs
I tried to use "SAT-M" as y-axis label, but "M" was cut off (actually went to second line that could not be seen). I tried every trick I know to lengthen the text box, to fit label on one line. Hi, The only way to length chart textboxes is with more text. But at some point more text will cause the content to wrap. The charts textboxes do not have the ability to be sized manually even though the bounding box and grab handles would suggest otherwise. Try adding a few spaces or even non-breaking spaces ALT+0160 (Numpad) Cheers Andy Peg wrote: > I tried to use &qu...

choice to colour text
Hi, hope someone can help. I have a shared spreadsheet with quite a lot of users. I need to categorise who is using the spreadsheet so that text that they add comes up in a different colour. Is there anyway to do this? I realise they could just change the text colour themselves, but it would be simpler in the long run if when they tried to input text they were faced with a question, and the answer changed the text colour automatically. Any help is much appreciated! Nick Hi, Maybe a user has to log in to the worksheet. eg when the sheet opens, an input box asks for username. The a...

Outlook 2003-Failing remember name when typing into the To: field
I just got Outlook 2002 and I was informed that when you send a message and typing in the To: field that if you have emailed someone before it would remember the name. For example: If I send an email to Shawn Hedrick the next time I send one I would only have to type maybe the first few letter and then it would prefill the rest. Does anyone know about this or how to set this up? tools, options, email options, advanced options - is suggest names checked? -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStar...

Dialog text only updated on mouse moves
My PreTranslateMessage() function has code in it to update some of the text in one of my dialog boxes. It works, but instead of updating it every second, it only udpates the text when my mouse is moving or clicking. Any ideas on what might be causing this? Thank you! Well, that's becuase PreTranslateMessage gets called only when there is message in the queue for that window. Instead use a timer. See OnTimer (WM_TIMER) AliR. <PloutzMR@Npt.NUWC.Navy.Mil> wrote in message news:1154456910.215194.170930@s13g2000cwa.googlegroups.com... > My PreTranslateMessage() function has c...

Data Validation date field
I don't understand why this isn't working. I just want to make sure that they don't put a future date in the polydate field. Is me.polydate > now() an invalid expression? code: _________________________________________________________ Private Sub Form_BeforeInsert(Cancel As Integer) If Me.PolyDate > Now() Then Cancel = True Me.PolyDate.SetFocus MsgBox "Please enter a date that falls prior to today's date" Exit Sub End If End Sub It does not appear to be invalid. It is always helpful to post the error you are getting and if it is a runti...

Adding Array Fields on forms
How to use Modifier to add an array fields of 3 elements on a form? thks in advance. Hi HFLO, Open modifier and select gp or 3rd party and then select exisiting modified form or select new form and then open window layout. From the Toolbox slect local fields in drop-down and press the new button and then enter field name and enter the array size for e.g. 3 and then select the datatype string or text and press OK button. Toolbox will show the newly created the array field, select that arrayfield and drag and dropped onto the layout 3 times. Hence ur array field would be there on ur for...

Result of one combo box, affecting results of another...
Just out of curiousity... Is there a way to have what the user selects in one combo box on a form, affect what is available for the user on another box!? For instance... Box A has 8 different addresses.. Within those addresses there are 12 different building ID locations... Instead of having all 12 building locations for each address always appear in the combo box, If the user picks building 4, is there a way to just have the building ID options for building 4 showing in combo box B? Charles! Use your favorite search engine. Use "Cascading Combo boxes" for search terms. -- Reg...

SOP Invoice: Custom footer based on logged in user or customer cla
I've been asked to determine if its possible to conditionally print footers on SOP Invoices to indicate the contact info of the person responsible for the client company. I was looking at either using the current logged in user or the class of the customer to determine which info to include. Can anyone point me to a KB article or some other source that can show me how to do this? Unforunately the user-defined fields in the customer record have already been dedicated to something else. TIA! VinceV You can attach some VBA code to the report and use the RetrieveGlobals.dll supplie...