Conditional Text in textbox control of continuous form

Hello,

I read a lot of things about conditional formating (color, font...) but how 
can I make a condition like: if text="ST" then text="PC"

So I just want to show other text in the specific textboxes in the 
continuous form in the case of condition. Is this possible?

juvi
0
Utf
3/15/2008 9:27:01 AM
access.formscoding 7493 articles. 0 followers. Follow

5 Replies
693 Views

Similar Articles

[PageSpeed] 35

Conditional formatting won't change the contents of the textbox. That's not
formatting, that's data.
You can do this with vba however.
A practical application would be if the user chooses a particular product in
a form and you want to put the price that is normally charged for this
product into the Price field - the user then has the option of changing this
amount if he wants to give the customer a discount or to totally rip him
off.

You would use the After Update Event of the text box which causes it all to
happen (more details available if required)

A typical code would look (in essence) like this - we'll call the text
box/field Product.

If Me.Product = "Pears" then
'the user has typed pears into the Product field
Me.ProductDescription = Fruit
'the ProductDescription field will now have the word Fruit appear in it
Me.Price = �2
'�2 appears in the Price field
End If



"juvi" <juvi@discussions.microsoft.com> wrote in message
news:F298AD96-21FC-488D-969F-DCB96A1B6036@microsoft.com...
> Hello,
>
> I read a lot of things about conditional formating (color, font...) but
how
> can I make a condition like: if text="ST" then text="PC"
>
> So I just want to show other text in the specific textboxes in the
> continuous form in the case of condition. Is this possible?
>
> juvi


0
Evi
3/15/2008 2:39:08 PM
the sample code doesn't work for me. now I added an SQL UPDATE for the 
"wrong" items to be corrected - so this edited my DATA. but it is really 
unconfortable that there is no possiblity to add some kind of conditions for 
alternate text

thx
"Evi" wrote:

> Conditional formatting won't change the contents of the textbox. That's not
> formatting, that's data.
> You can do this with vba however.
> A practical application would be if the user chooses a particular product in
> a form and you want to put the price that is normally charged for this
> product into the Price field - the user then has the option of changing this
> amount if he wants to give the customer a discount or to totally rip him
> off.
> 
> You would use the After Update Event of the text box which causes it all to
> happen (more details available if required)
> 
> A typical code would look (in essence) like this - we'll call the text
> box/field Product.
> 
> If Me.Product = "Pears" then
> 'the user has typed pears into the Product field
> Me.ProductDescription = Fruit
> 'the ProductDescription field will now have the word Fruit appear in it
> Me.Price = £2
> '£2 appears in the Price field
> End If
> 
> 
> 
> "juvi" <juvi@discussions.microsoft.com> wrote in message
> news:F298AD96-21FC-488D-969F-DCB96A1B6036@microsoft.com...
> > Hello,
> >
> > I read a lot of things about conditional formating (color, font...) but
> how
> > can I make a condition like: if text="ST" then text="PC"
> >
> > So I just want to show other text in the specific textboxes in the
> > continuous form in the case of condition. Is this possible?
> >
> > juvi
> 
> 
> 
0
Utf
3/15/2008 4:33:01 PM
This would be exactly what I am looking for but I get a syntax error trying 
to set.
these are my names
-----------------------
column-name: ME
textbox-name: tbME

I tried the following:

=IIf(ME = "ST", "PC", ME)     and tried also   =IIf(tbME = "ST", "PC", tbME)

but I get syntac error.

"Marshall Barton" wrote:

> An Update query is a good way to permantly change the data.
> 
> If you only want to display one thing when the value of a
> field is something else, you can use a text box expression
> (VBA code won't do it on a continuous form):
> 
> 	=IIf(field = "ST", "PC", field)
> 
> but that text box will not be updateable.
> -- 
> Marsh
> MVP [MS Access]
> 
> 
> juvi wrote:
> >the sample code doesn't work for me. now I added an SQL UPDATE for the 
> >"wrong" items to be corrected - so this edited my DATA. but it is really 
> >unconfortable that there is no possiblity to add some kind of conditions for 
> >alternate text
> >
> >> 
> >> "juvi" <juvi@discussions.microsoft.com> wrote
> >> > I read a lot of things about conditional formating (color, font...) but
> >> how
> >> > can I make a condition like: if text="ST" then text="PC"
> >> >
> >> > So I just want to show other text in the specific textboxes in the
> >> > continuous form in the case of condition. Is this possible?
> 
0
Utf
3/15/2008 5:56:00 PM
An Update query is a good way to permantly change the data.

If you only want to display one thing when the value of a
field is something else, you can use a text box expression
(VBA code won't do it on a continuous form):

	=IIf(field = "ST", "PC", field)

but that text box will not be updateable.
-- 
Marsh
MVP [MS Access]


juvi wrote:
>the sample code doesn't work for me. now I added an SQL UPDATE for the 
>"wrong" items to be corrected - so this edited my DATA. but it is really 
>unconfortable that there is no possiblity to add some kind of conditions for 
>alternate text
>
>> 
>> "juvi" <juvi@discussions.microsoft.com> wrote
>> > I read a lot of things about conditional formating (color, font...) but
>> how
>> > can I make a condition like: if text="ST" then text="PC"
>> >
>> > So I just want to show other text in the specific textboxes in the
>> > continuous form in the case of condition. Is this possible?
0
Marshall
3/15/2008 6:17:47 PM
juvi wrote:

>This would be exactly what I am looking for but I get a syntax error trying 
>to set.
>these are my names
>-----------------------
>column-name: ME
>textbox-name: tbME
>
>I tried the following:
>
>=IIf(ME = "ST", "PC", ME)     and tried also   =IIf(tbME = "ST", "PC", tbME)
>
>but I get syntac error.


Neither of those should get a syntax error.  The second one
will return #Error because a text box expression can not
refer to itself.

Me is a reserved word in a VBA class module, bur not in a
text box control source expression, so that should cause a
problem here.

Are you sure you put that expression in the text box's
ControlSource property?

Are you sure that the ME field in the table really contains
ST?  (e.g. If the table field is a lookup field, it could
really be a number.)

-- 
Marsh
MVP [MS Access]
0
Marshall
3/15/2008 10:42:41 PM
Reply:

Similar Artilces:

Print Form Page
Hi, I would like to have a button that prints just the page of the form that you are viewing. Below is the basic. How can I change it to have it print only one page? Thanks. Private Sub PrintScreen_Click() On Error GoTo Err_PrintScreen_Click Dim stDocName As String Dim MyForm As Form stDocName = "Baylor_2008" Set MyForm = Screen.ActiveForm DoCmd.SelectObject acForm, stDocName, True DoCmd.PrintOut DoCmd.SelectObject acForm, MyForm.Name, False Exit_PrintScreen_Click: Exit Sub Err_PrintScreen_Click: MsgBox Err.Description Resume Exit_Prin...

macro to print form to PDFCreator
We have a cost of quality database with 18,000 records and growing. Customer service opens the claim form and finds the claim that they are looking for. They need to be able to e-mail this to our credit manager in pdf format so that she can issue the credit memo and so it can be sent to our imaging software in pdf format. We have PDFCreator installed on their PC but I want to create a button on the form to automate this so that they don't accidentally print all 18,000 records to a pdf file and they don't forget to change their printer to PDFCreator. I think it will have to be accomp...

Text Moves
I have a user using Publisher XP SP3. When she opens a Previously Created Brochure - changes some text and selects save, the text moves and then the document is saved with the incorrect formatted text. I cannot seem to correct this. At first I thought it might be a corrupt graphic, but after testing I don't think so. Any suggestions? It could be a printer driver issue. -- JoAnn Paules MVP Microsoft [Publisher] "Gladys" <Gladys@discussions.microsoft.com> wrote in message news:9B3EF87A-6070-4B4F-A039-B4FABB70B588@microsoft.com... >I have a user using Publisher...

Dis/En-able combo text box and resetting a form
Sorry for the long-windedness! I am a coding amateur. I am having a few issues with a combo box and a "Reset" command button. I have a combo box called "PrimaryIssue", and option 6 in the box is "Other". I have been trying to set it up so that a text box is only enabled if the user selects the "Other" option. I have been having limited success with the following code (which I believe I found on this site somewhere): Private Sub PrimaryIssue_AfterUpdate() Dim varItm As Variant For Each varItm In PrimaryIssue.ItemsSelected If PrimaryIssu...

how do i delete connected text boxes?
i need to delete a sperate section in a text box on Publisher. it's in the vintage newsletter and the Inside this issue section Unlink the text boxes, the text will stay in text box one. You will have to delete the text by elongating the first text box. -- Mary Sauer http://msauer.mvps.org/ "drjones168" <drjones168@discussions.microsoft.com> wrote in message news:2949781C-9685-4614-B7C3-2418E76C02D0@microsoft.com... > i need to delete a sperate section in a text box on Publisher. it's in the > vintage newsletter and the Inside this issue secti...

Today Conditional Format
I have a column which calculated a date based on 3 working days from a date input into a diff column. What I want to do I have the calculated date appear bold if that date has passed based on the current date. For example if I input 01/08/11 the next column calculates 04/08/11 (3 working days). I want the caluclated date to appear bold when I open the spreadsheet on the 05/08/11 ro show the calculated date has passed. I can use conditional formatting but can't get the syntax right Regards Andy Win XP Pro Office 2010 Andy Roberts presented the following explanation : > I ha...

Getting value from edit control?
How do I get the value from an edit control into its value CString variable? Also, how do I convert from CString to char* ? CString has an overload for LPCTSTR (which depends on whether you are compiled for Unicode or MBCS) so you can pass it pretty easily. If you need to access the buffer directly CString::GetBuffer() returns the pointer to the buffer. Call ReleaseBuffer() when you are done using that point (if you modify it). To assign and retrieve values with the edit control you should create a variable for the control and use UpdateData(). Open the dialog and right click on ...

Two Condition Vlookup?
I am currently trying to create a function that searches through an array for two exact column values which allows me to retrieve a third column value. For example: Type of Fruit Date Packaged Amount of Fruit Apples June 100 Oranges June 50 Apples July 75 Grapes July 50 In this example, I would be looking to retrieve the Amount of Fruit (Apples) that was packaged in July. I would be putt...

Change case of text
I have Word 2007. In earlier versions of Word under the Format tab there was a change case option that made it easy to change selected text to all upper, lower, etc. I cannot fund this function in Word 2007. Where is it? -- Thanks for your help - jjk98 Home tab, Font Group, Change Case "Aa" icon. Also, does Shft+F3 toggle the text, from no caps - initial caps - all caps? Hope this helps DeanH "jjk98" wrote: > I have Word 2007. In earlier versions of Word under the Format tab there was > a change case option that made it easy to change selected...

Autoload a form
Hi everybody I might sound stupid but I have to face it. I would like to open a form while opening a database instead of the database. That is i want a user to get access to a form not the database as it is gives the user a choice to see the table, queries etc. Just like VB when you create a form and load the application it is the form that opens. More so am i suppose to do something to make it an exe. Could somebody help me please Regards Parmesiven Open the database (.mdb file) to the database window. Select Tools | Startup, and set the name of the form you want to have be shown...

Query condition by date range
I'm trying to create a query to base a report from. I need it to return records within a date range that needs to be specified, as in specifying the beginning date and having the current date as the end date. A field is included in the query that has listed dates in the format mm/dd/yyyy. How would I write the criteria? I have part of it ready - [Please enter starting date:] . I know that's how you get the little question window. On Tue, 4 Dec 2007 14:51:00 -0800, silva wrote: > I'm trying to create a query to base a report from. I need it to return > records within a...

Need help with conditional formula (Excel 97)
Can anyone give me the correct syntax for the following formula: if A1 is blank, and B1 is more than zero, then display B1, otherwise display nothing (blank cell) Thank you JD =IF(AND(A1="",B1>0),B1,"") Success! -- met vriendelijke groetjes "Jake D" <JakeD@djhtend.com> schreef in bericht news:crkto4lv30u7uujv27ek8okr0us5t9oj10@4ax.com... > Can anyone give me the correct syntax for the following formula: > > if A1 is blank, and B1 is more than zero, then display B1, otherwise > display nothing (blank cell) > > Thank you > > ...

Inserting a text Watermark automatically moves all text down one l
In Word 2003, when I try and insert a text watermark from the Format/Background menu, on pages with .3 or less margins, there is a flicker and all the text automatically moves down one line. Clicking Undo (or the blue back arrow) removes the watermark, but DOES NOT move the text back up. I need the .3 margins and a ‘CONFIDENTIAL’ text watermark for this particular document. I tried changing the ‘Auto’ size option, with no difference. Is this an unnoticed and unfixable glitch in Word 2003? How can I insert the watermark without the text being moved down? Also, what size text...

Selecting Multiple Controls
I have about a hundred checkbox controls on a worksheet. I need to select differing subsets of multiple controls in order to move or modify them. I have entered 'Design Mode' on the 'Developer' tab and activated the 'Select Objects' option from the 'Find and Replace' feature on the 'Home' tab. With that combination I can drag over the controls, but this action does not select the controls. What must we do in order to drag and select large groups of controls? Max You can select multiple controls by using control-click to add addit...

Conditional formatting if condition of an if statement is true and a string value is displayed
Dear Experts: I got a nested 'IF'-Formula in an excel cell that returns nothing if the condition is false. I would like to conditionally format this cell with grey shading if the condition is true and a string value is displayed. How can this be achieved using excel conditional formating functionality ? Help is much appreciated. Thank you very much in advance. Regards, Andreas Let's say your doing this conditional formatting in cell K17. In conditional formatting (xl2003) choose the FormulaIs: option and enter: =$K$17<>"" choose your formatt...

form customization 10-17-03
Hi; I have customized a totally new form for creating accounts and saved it, but now when I want to create new accounts the old form shows up and don't know how to access the new form! do you know what the problem could be? thanks, Farshad you need to publish your changes, goto Deployment Manager, and run "Publish" on the object you changed (ie accounts, leads, opportunity, etc). then restart IIS -Gary "farshad" <farshad@seancesoft.com> wrote in message news:037d01c394f8$3fd611e0$a401280a@phx.gbl... > Hi; > > I have customized a totally new form ...

Convert text to time value
I have a series of time values in a 'General' format. They are of the type: 184525 Which is 18:45:25 or 6:45:25 pm. A time which is am would be of the type: 12345 Which is 1:23:45 am. Is there a way to convert those 'General' values to an Excel serial so that I can figure out the difference between two times? I've seen a bunch of examples on the net, but none of those that I have found deal with this format that I can tell. Thanks. Hi try =--TEXT(A1,"00:00:00") -- Regards Frank Kabel Frankfurt, Germany "Andy" <amelton@gmail.com> schrieb...

Conditional Field in Queries
Is there a way to make a field in a query conditional so that it only displays the value if the value is equal to something specifically set? Thanks. Nick Nick.Korynski@gmail.com wrote: > Is there a way to make a field in a query conditional so that it only > displays the value if the value is equal to something specifically > set? Thanks. > > Nick Explain "the value is equal to something specifically set". -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com ...

How do i use Conditional formatting for 3+ conditions ?
I have a text box in a report which highlights in colour current members in a list of past and present member names. I have six types of current members that I want to highlight, but with conditional formatting I can only use 3 conditions in the members [Type] field. I have tried [Type]="Full member" Or "Life member" but the "Or" doesn't work ! Is there a way to do this ? thanks .. Roger CF is limited to 3 contitions, but you can use OR in those expressions. If you set Condition1 to Expression, you can use: ([Type] = "Full member") Or (...

Help with Conditional formatting with Dates
Hi there, I have a spreadsheet in which I have to monitor various dates which are in different columns (i.e. (1) Date Tender Released, (2) Date Company Selected, (3) Date Draft Contract Forwarded, (4) Date Contract Signed etc...). Would if be possible to Conditional Format and have diffirent ROWs highlighted for each individual Contracts (I have 300 running contracts running) every time a date is filled in these different columns: Initial Step (1) = Yellow (Call for Tender released) Step (2) = Blue (Company Selected) Step (3) = Brown (Contract under Process) Step (4) = Green (Contract Si...

Conditional null value
Wondering if anyone can suggest a way to simplify the following code, which I’m using in the OnFormat event of a report. If Not IsNull(DLookup("[ICD2]", "EntryICDs", "[EntryNum] = " & Me! [PtAcct#])) Then Me![Field192] = Replace(DLookup("[ICD2]", "EntryICDs", "[EntryNum] = " & Me![PtAcct#]), ".", " ") End If If Not IsNull(DLookup("[ICD3]", "EntryICDs", "[EntryNum] = " & Me! [PtAcct#])) Then Me![Field194] = Replace(DLookup("[ICD...

Change "Text Numbers" to "Numbers"
Hello, Can you tell me how to (with a macro) change a range of cells that have text numbers to real numbers so I can use them in formulas and also have them show up as real numbers if I save the file as a .prn file. The range of cells begin in row 2 from column C through column AZ. I would really appreciate your help. I have spent days on this and I'm still lost. Thank You, Nichole Hi try the following: - set the format for these cells to a 'number' format' - select an empty cell and copy this cell - select your range of text numbers - goto 'Edit - Paste Special&#...

CFile and CStdioFile, text or binary, ANSI or Unicode, etc.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_CFile.3a3a.CFile.asp (CFile constructor) says: > CFile::typeText Sets text mode with special processing for carriage > return?linefeed pairs (used in derived classes only). > CFile::typeBinary Sets binary mode (used in derived classes only). OK, let's look at a derived class first. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_CStdioFile.3a3a.ReadString.asp (CStdioFile::ReadString) says: > virtual LPTSTR ReadString( > LPTSTR lpsz, > UINT nMax >...

Great Plains 8.0 on a Domain Controller
Has anyone ever experienced any problems installing Great Plains 8.0 Standard on a Windows 2003 Server Domain Controller? The site has a very low number of users (8) and they want to do this. Any issues with GP support after the fact? Thanks, Kevin Cristiano Nope.... I have a GP MSSQL system running on SBS 2003, which is a domain controller, with exchange, isa and other things. Just make sure you have enough hardware and resources MLF "KJC" wrote: > Has anyone ever experienced any problems installing Great Plains 8.0 > Standard on a Windows 2003 Server Domain Cont...

Display ALL text contents in cell
I am having trouble displaying all the contents in the cell. It is som lengthy information in the cell. I have made the row height as high a it will go, but it still won't display all the information. I canno make the column width any wider than I have it set, because then th other columns will not fit on the page. Does anyone know how t overcome this problem? : -- Flipper106 ----------------------------------------------------------------------- Flipper1067's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2561 View this thread: http://www.excelforum.com/...