Re: Using VBA need to add a text box to a form



Look okay.

Form tblExcel_Check must be open in design view.
The form must have a textbox (or combo) named txtCurrent, and another
control named GroupOrderNo.
The acEqual operator will be ignored.

What error are you receiving?

Another way to get the result you are after is to manually add the format
condition (via Format | Conditional Formatting), and then testing what
Access gave you. Open the Immediate Window (Ctrl+G), and enter:
? Forms!tblExcel_Check.txtCurrent.FormatConditions.Count
? Forms!tblExcel_Check.txtCurrent.FormatConditions(0).BackColor
and so on to understand what is there.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Trever B" <TreverB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B4F355F7-4197-4720-9CF5-7638B5D85293@xxxxxxxxxxxxxxxx
Hi,

Trouble's back

Still can't get this right.

Currently I have:

txtCurrent = "F" & Fieldss

Forms!tblExcel_Check.txtCurrent.FormatConditions.Add acExpression,
acEqual, "[GroupOrderNo]=1",
Forms!tblExcel_Check.txtCurrent.FormatConditions.Item(0).BackColor =
15592886


I have a defination problem.

Can you be good enough to correct it for me.

"Allen Browne" wrote:

This example adds a format condition to the text box named Amount on
Form1,
to show negative values in red:

With Forms!Form1.Amount.FormatConditions
.Add acFieldValue, acLessThan, 0
.Item(.Count - 1).ForeColor = vbRed
End With

"Trever B" <TreverB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1AF62A77-E21E-46C5-A6CE-0F6F616D14AF@xxxxxxxxxxxxxxxx
Sorry Alan,

Just a bit thick on this point. how do a do add method if possible give
an
example

Regards.

Trev.

ps I am always glad when you reply as you always give the best, most
correct
and to the point answers.

"Allen Browne" wrote:

If the control is a TextBox or ComboBox, you can use the Add method of
its
FormatConditions collection to add up to 3 format conditions.

"Trever B" <TreverB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:13EC3E5A-F8B6-4BFD-BA68-AE09164A0505@xxxxxxxxxxxxxxxx
Thanks for that.

How for the follow up.

Is it possible at the time of adding the item to put a conditional
format
in
place.

If so, How.

If not how do I get around it.

Thanks

Trev

"Allen Browne" wrote:

You cannot do this while the form is in use, so this technique is
not
suitable for any database where you plan to release an MDE for
users.

If you are designing some kind of wizard/tool for development
purposes,
you
can create a text box like this (assuming Form1 is open in design
view):

Dim txt As TextBox
Set txt = CreateControl("Form1", acTextBox, acDetail, , , _
1440, 1440, 1440, 285)
txt.Name = "MyNewControl"

"Trever B" <TreverB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B1EFA54B-E78D-4CD4-9E32-5B5732E185CF@xxxxxxxxxxxxxxxx
Hi,

Thanks in advance.

Using VBA I want to a boxes to a form.

I am ok with the loop but just how do you add a textbox to a form
using
code.


.



Relevant Pages

  • Re: Newbie question on formatting a field in table design
    ... Each department field is set to the default format ... multiplies the number entered by 100 and adds the "%" sign. ... right of the textbox, then store the number that way and do the ... normalized table design would convert your 11 ...
    (comp.databases.ms-access)
  • Re: Use TextBox Text As Function Name!
    ... the text in the TextBox changes to "<the name of the ... > OptionButton that was checked just before the selection change>2<the ... You have some design issues here. ... using the most common format. ...
    (microsoft.public.vb.general.discussion)
  • Re: Using VBA need to add a text box to a form
    ... FormatConditions collection to add up to 3 format conditions. ... Allen Browne - Microsoft MVP. ... If you are designing some kind of wizard/tool for development purposes, ... I am ok with the loop but just how do you add a textbox to a form using ...
    (microsoft.public.access.formscoding)
  • Re: Using VBA need to add a text box to a form
    ... If the control is a TextBox or ComboBox, you can use the Add method of its ... FormatConditions collection to add up to 3 format conditions. ... Allen Browne - Microsoft MVP. ...
    (microsoft.public.access.formscoding)
  • Re: Using VBA need to add a text box to a form
    ... Allen Browne - Microsoft MVP. ... txtCurrent is a string and the Added fields are F1 to F unspecified ... The form must have a textbox named txtCurrent, ... Another way to get the result you are after is to manually add the format ...
    (microsoft.public.access.formscoding)

Loading