p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

access thread: Customized text box


Message #1 by "Ajay Jain" <ajain@i...> on Wed, 26 Jun 2002 11:40:18 -0400
Hi all:

I am facing an interesting logical problem here. I have few text boxes on my
form. The form is bound to a table and the text boxes are bound to the
columns of that table. When the form is displayed the text boxes bring
values from the table. I want to hide certain values of text boxes. Eg. If
value of text box is "X", I want to hide it or reset it to blank. And I want
to do this even before displaying the values  on form.

Now, the problem is neither can I reset the values to blank as the fields in
table are "NOT NULL" nor can I hide the values before the text box gets the
focus.

I was wondering if we can use Input mask or some other property.

Any solutions to get around with the problem??

Thanks for your time.

Ajay Jain

Message #2 by Omar Chaudry <OChaudry@b...> on Wed, 26 Jun 2002 16:44:12 +0100
Base your controls' data source on a query rather than the base table and
for fields that you want to manipulate values use something like:-
NewDisplay: iif([field_Name]="X","",[field_name])
In the the QED grid.

HTH
Omar

-----Original Message-----
From: Ajay Jain [mailto:ajain@i...] 
Sent: 26 June 2002 16:40
To: Access
Subject: [access] Customized text box

Hi all:

I am facing an interesting logical problem here. I have few text boxes on my
form. The form is bound to a table and the text boxes are bound to the
columns of that table. When the form is displayed the text boxes bring
values from the table. I want to hide certain values of text boxes. Eg. If
value of text box is "X", I want to hide it or reset it to blank. And I want
to do this even before displaying the values  on form.

Now, the problem is neither can I reset the values to blank as the fields in
table are "NOT NULL" nor can I hide the values before the text box gets the
focus.

I was wondering if we can use Input mask or some other property.

Any solutions to get around with the problem??

Thanks for your time.

Ajay Jain




  DISCLAIMER: The information in this message is confidential and may be
legally privileged. It is intended solely for the addressee.  Access to this
message by anyone else is unauthorised.  If you are not the intended
recipient, any disclosure, copying, or distribution of the message, or any
action or omission taken by you in reliance on it, is prohibited and may be
unlawful.  Please immediately contact the sender if you have received this
message in error. Thank you.


Message #3 by braxis@b... on Wed, 26 Jun 2002 16:54:50 +0100 (BST)
On the Forms Current event do something like this:

    if me![txtToHide]="Bad Value" Then
        me![txtToHide].Visible = false
    else
        me![txtToHide].Visible = true
    endif

Brian
>  from:    Ajay Jain <ajain@i...>
>  date:    Wed, 26 Jun 2002 16:40:18
>  to:      access@p...
>  subject: Re: [access] Customized text box
> 
> Hi all:
> 
> I am facing an interesting logical problem here. I have few text boxes on my
> form. The form is bound to a table and the text boxes are bound to the
> columns of that table. When the form is displayed the text boxes bring
> values from the table. I want to hide certain values of text boxes. Eg. If
> value of text box is "X", I want to hide it or reset it to blank. And I want
> to do this even before displaying the values  on form.
> 
> Now, the problem is neither can I reset the values to blank as the fields in
> table are "NOT NULL" nor can I hide the values before the text box gets the
> focus.
> 
> I was wondering if we can use Input mask or some other property.
> 
> Any solutions to get around with the problem??
> 
> Thanks for your time.
> 
> Ajay Jain
> 
> 

Message #4 by "John Ruff" <papparuff@c...> on Wed, 26 Jun 2002 08:55:08 -0700
Use the form's On Current event.

Private Sub Form_Current()

   If txtMyField = "X" Then
      txtMyField .Visible = False
   Else
      txtMyField .Visible = True
   End IftxtMyField 

End Sub 


John V. Ruff - The Eternal Optimist :-)
Always Looking for Contract Opportunities

www.noclassroom.com

Home:  xxx.xxx.xxxx
Cell:  xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498 
 
"Commit to the Lord whatever you do,
    and your plans will succeed."  Proverbs 16:3


-----Original Message-----
From: Ajay Jain [mailto:ajain@i...] 
Sent: Wednesday, June 26, 2002 8:40 AM
To: Access
Subject: [access] Customized text box


Hi all:

I am facing an interesting logical problem here. I have few text boxes
on my form. The form is bound to a table and the text boxes are bound to
the columns of that table. When the form is displayed the text boxes
bring values from the table. I want to hide certain values of text
boxes. Eg. If value of text box is "X", I want to hide it or reset it to
blank. And I want to do this even before displaying the values  on form.

Now, the problem is neither can I reset the values to blank as the
fields in table are "NOT NULL" nor can I hide the values before the text
box gets the focus.

I was wondering if we can use Input mask or some other property.

Any solutions to get around with the problem??

Thanks for your time.

Ajay Jain



Message #5 by "Ajay Jain" <ajain@i...> on Wed, 26 Jun 2002 12:08:53 -0400
Thanks for the prompt response John.

But this code will hide the text box . I want only the value to go off and
not the text box itself.

Ajay Jain


-----Original Message-----
From: John Ruff [mailto:papparuff@c...]
Sent: Wednesday, June 26, 2002 11:55 AM
To: Access
Subject: [access] RE: Customized text box


Use the form's On Current event.

Private Sub Form_Current()

   If txtMyField = "X" Then
      txtMyField .Visible = False
   Else
      txtMyField .Visible = True
   End IftxtMyField

End Sub


John V. Ruff - The Eternal Optimist :-)
Always Looking for Contract Opportunities

www.noclassroom.com

Home:  xxx.xxx.xxxx
Cell:  xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498

"Commit to the Lord whatever you do,
    and your plans will succeed."  Proverbs 16:3


-----Original Message-----
From: Ajay Jain [mailto:ajain@i...]
Sent: Wednesday, June 26, 2002 8:40 AM
To: Access
Subject: [access] Customized text box


Hi all:

I am facing an interesting logical problem here. I have few text boxes
on my form. The form is bound to a table and the text boxes are bound to
the columns of that table. When the form is displayed the text boxes
bring values from the table. I want to hide certain values of text
boxes. Eg. If value of text box is "X", I want to hide it or reset it to
blank. And I want to do this even before displaying the values  on form.

Now, the problem is neither can I reset the values to blank as the
fields in table are "NOT NULL" nor can I hide the values before the text
box gets the focus.

I was wondering if we can use Input mask or some other property.

Any solutions to get around with the problem??

Thanks for your time.

Ajay Jain





Message #6 by "Leo Scott" <leoscott@c...> on Wed, 26 Jun 2002 09:16:34 -0700
Try,

with Me.txtBoxName
   .ForeColor=.BackColor
end with

You will also have to disable and or lock the textbox so the user doesn't
get confused if they try to enter a value in the textbox while they cannot
see what they are typing.

|-----Original Message-----
|From: Ajay Jain [mailto:ajain@i...]
|Sent: Wednesday, June 26, 2002 9:09 AM
|To: Access
|Subject: [access] RE: Customized text box
|
|
|Thanks for the prompt response John.
|
|But this code will hide the text box . I want only the value to go off and
|not the text box itself.
|
|Ajay Jain
|
|
|-----Original Message-----
|From: John Ruff [mailto:papparuff@c...]
|Sent: Wednesday, June 26, 2002 11:55 AM
|To: Access
|Subject: [access] RE: Customized text box
|
|
|Use the form's On Current event.
|
|Private Sub Form_Current()
|
|   If txtMyField = "X" Then
|      txtMyField .Visible = False
|   Else
|      txtMyField .Visible = True
|   End IftxtMyField
|
|End Sub
|
|
|John V. Ruff - The Eternal Optimist :-)
|Always Looking for Contract Opportunities
|
|www.noclassroom.com
|
|Home:  xxx.xxx.xxxx
|Cell:  xxx.xxx.xxxx
|9306 Farwest Dr SW
|Lakewood, WA 98498
|
|"Commit to the Lord whatever you do,
|    and your plans will succeed."  Proverbs 16:3
|
|
|-----Original Message-----
|From: Ajay Jain [mailto:ajain@i...]
|Sent: Wednesday, June 26, 2002 8:40 AM
|To: Access
|Subject: [access] Customized text box
|
|
|Hi all:
|
|I am facing an interesting logical problem here. I have few text boxes
|on my form. The form is bound to a table and the text boxes are bound to
|the columns of that table. When the form is displayed the text boxes
|bring values from the table. I want to hide certain values of text
|boxes. Eg. If value of text box is "X", I want to hide it or reset it to
|blank. And I want to do this even before displaying the values  on form.
|
|Now, the problem is neither can I reset the values to blank as the
|fields in table are "NOT NULL" nor can I hide the values before the text
|box gets the focus.
|
|I was wondering if we can use Input mask or some other property.
|
|Any solutions to get around with the problem??
|
|Thanks for your time.
|
|Ajay Jain
|
|
|
|
|
|

Message #7 by "Darin Wray" <darin@r...> on Wed, 26 Jun 2002 11:18:29 -0500
perhaps make an unbound and locked text box that (no label with the text
box) that is placed directly over the bound text box in design view, and is
defaulted to not be visible.  at runtime, use john's same if statement, but
unhide the unbound text box, and hide the bound text box if your value is
true.

there's probably a more elegant way to do this...

Darin


----- Original Message -----
From: "Ajay Jain" <ajain@i...>
To: "Access" <access@p...>
Sent: Wednesday, June 26, 2002 11:08 AM
Subject: [access] RE: Customized text box


> Thanks for the prompt response John.
>
> But this code will hide the text box . I want only the value to go off and
> not the text box itself.
>
> Ajay Jain
>
>
> -----Original Message-----
> From: John Ruff [mailto:papparuff@c...]
> Sent: Wednesday, June 26, 2002 11:55 AM
> To: Access
> Subject: [access] RE: Customized text box
>
>
> Use the form's On Current event.
>
> Private Sub Form_Current()
>
>    If txtMyField = "X" Then
>       txtMyField .Visible = False
>    Else
>       txtMyField .Visible = True
>    End IftxtMyField
>
> End Sub
>
>
> John V. Ruff - The Eternal Optimist :-)
> Always Looking for Contract Opportunities
>
> www.noclassroom.com
>
> Home:  xxx.xxx.xxxx
> Cell:  xxx.xxx.xxxx
> 9306 Farwest Dr SW
> Lakewood, WA 98498
>
> "Commit to the Lord whatever you do,
>     and your plans will succeed."  Proverbs 16:3
>
>
> -----Original Message-----
> From: Ajay Jain [mailto:ajain@i...]
> Sent: Wednesday, June 26, 2002 8:40 AM
> To: Access
> Subject: [access] Customized text box
>
>
> Hi all:
>
> I am facing an interesting logical problem here. I have few text boxes
> on my form. The form is bound to a table and the text boxes are bound to
> the columns of that table. When the form is displayed the text boxes
> bring values from the table. I want to hide certain values of text
> boxes. Eg. If value of text box is "X", I want to hide it or reset it to
> blank. And I want to do this even before displaying the values  on form.
>
> Now, the problem is neither can I reset the values to blank as the
> fields in table are "NOT NULL" nor can I hide the values before the text
> box gets the focus.
>
> I was wondering if we can use Input mask or some other property.
>
> Any solutions to get around with the problem??
>
> Thanks for your time.
>
> Ajay Jain
>
>
>
>
>
>
>

Message #8 by "John Ruff" <papparuff@c...> on Wed, 26 Jun 2002 10:05:32 -0700
Then

   If txtMyField = "X" Then
      txtMyField .Enable = False
   Else
      txtMyField .Enabled = True
   End IftxtMyField


Or to change the value from X to ""

	if txtMyField="X" then
		txtMyField=""
	endif

Again, do this in the Form's On Current event



John V. Ruff - The Eternal Optimist :-)
Always Looking for Contract Opportunities

www.noclassroom.com

Home:  xxx.xxx.xxxx
Cell:  xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498 
 
"Commit to the Lord whatever you do,
    and your plans will succeed."  Proverbs 16:3


-----Original Message-----
From: Ajay Jain [mailto:ajain@i...] 
Sent: Wednesday, June 26, 2002 9:09 AM
To: Access
Subject: [access] RE: Customized text box


Thanks for the prompt response John.

But this code will hide the text box . I want only the value to go off
and not the text box itself.

Ajay Jain


-----Original Message-----
From: John Ruff [mailto:papparuff@c...]
Sent: Wednesday, June 26, 2002 11:55 AM
To: Access
Subject: [access] RE: Customized text box


Use the form's On Current event.

Private Sub Form_Current()

   If txtMyField = "X" Then
      txtMyField .Visible = False
   Else
      txtMyField .Visible = True
   End IftxtMyField

End Sub


John V. Ruff - The Eternal Optimist :-)
Always Looking for Contract Opportunities

www.noclassroom.com

Home:  xxx.xxx.xxxx
Cell:  xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498

"Commit to the Lord whatever you do,
    and your plans will succeed."  Proverbs 16:3


-----Original Message-----
From: Ajay Jain [mailto:ajain@i...]
Sent: Wednesday, June 26, 2002 8:40 AM
To: Access
Subject: [access] Customized text box


Hi all:

I am facing an interesting logical problem here. I have few text boxes
on my form. The form is bound to a table and the text boxes are bound to
the columns of that table. When the form is displayed the text boxes
bring values from the table. I want to hide certain values of text
boxes. Eg. If value of text box is "X", I want to hide it or reset it to
blank. And I want to do this even before displaying the values  on form.

Now, the problem is neither can I reset the values to blank as the
fields in table are "NOT NULL" nor can I hide the values before the text
box gets the focus.

I was wondering if we can use Input mask or some other property.

Any solutions to get around with the problem??

Thanks for your time.

Ajay Jain


---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 


---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 



Message #9 by "Amy Wyatt" <amyw@c...> on Thu, 27 Jun 2002 13:16:13
Be VERY careful with Bound Text boxes and the suggestions of changing the 
value to "" because that will actually change the value in the underlying 
table. The suggestion of overlaying controls if fine but not recommended 
if it can be avoided because it has been know to slow down Access 2000 (my 
experience anyway, if Access is the back and front end anyway). There is 
another way you can do this without using overlapping controls and that is 
to simply unbind the control on True and bind it again on False like this:

   If txtText="X" Then
      txtText.ControlSource=""
   Else
      txtText.ControlSource="MyField"
   End IF

That way the record value itself is protected but it nolonger shows in the 
textbox. Be sure you lock or disable the newly unbound control so the user 
does not type anything in thinking it will add or change the value.

Hope this helps,

Amy

> Then

   If txtMyField = "X" Then
      txtMyField .Enable = False
   Else
      txtMyField .Enabled = True
   End IftxtMyField


Or to change the value from X to ""

	if txtMyField="X" then
		txtMyField=""
	endif

Again, do this in the Form's On Current event



John V. Ruff - The Eternal Optimist :-)
Always Looking for Contract Opportunities

www.noclassroom.com

Home:  xxx.xxx.xxxx
Cell:  xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498 
 
"Commit to the Lord whatever you do,
    and your plans will succeed."  Proverbs 16:3


-----Original Message-----
From: Ajay Jain [mailto:ajain@i...] 
Sent: Wednesday, June 26, 2002 9:09 AM
To: Access
Subject: [access] RE: Customized text box


Thanks for the prompt response John.

But this code will hide the text box . I want only the value to go off
and not the text box itself.

Ajay Jain


-----Original Message-----
From: John Ruff [mailto:papparuff@c...]
Sent: Wednesday, June 26, 2002 11:55 AM
To: Access
Subject: [access] RE: Customized text box


Use the form's On Current event.

Private Sub Form_Current()

   If txtMyField = "X" Then
      txtMyField .Visible = False
   Else
      txtMyField .Visible = True
   End IftxtMyField

End Sub


John V. Ruff - The Eternal Optimist :-)
Always Looking for Contract Opportunities

www.noclassroom.com

Home:  xxx.xxx.xxxx
Cell:  xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498

"Commit to the Lord whatever you do,
    and your plans will succeed."  Proverbs 16:3


-----Original Message-----
From: Ajay Jain [mailto:ajain@i...]
Sent: Wednesday, June 26, 2002 8:40 AM
To: Access
Subject: [access] Customized text box


Hi all:

I am facing an interesting logical problem here. I have few text boxes
on my form. The form is bound to a table and the text boxes are bound to
the columns of that table. When the form is displayed the text boxes
bring values from the table. I want to hide certain values of text
boxes. Eg. If value of text box is "X", I want to hide it or reset it to
blank. And I want to do this even before displaying the values  on form.

Now, the problem is neither can I reset the values to blank as the
fields in table are "NOT NULL" nor can I hide the values before the text
box gets the focus.

I was wondering if we can use Input mask or some other property.

Any solutions to get around with the problem??

Thanks for your time.

Ajay Jain


---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 


---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 




  Return to Index