PC Review


Reply
Thread Tools Rate Thread

Clear text field and db entry

 
 
=?Utf-8?B?TmluaWVs?=
Guest
Posts: n/a
 
      1st Nov 2006
Hello,

I have a checkbox that when checked makes a textbox visible, and when not
checked, or unchecked, leaves/makes it invisible.
People are expected to check the box and then enter text, and on
AfterUpdate, the content of the checkbox is used to update the form's
underlying query.

When the texbox is hidden again by unchecking the checkbox, I would like to
remove the data that was stored in there.
I can use txtbox.Value = Null to clear the text box, but the data in the
query isn't touched by this, or if it is, the change is not saved.

What is a good way to delete that information from the db?

Thank you.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?TmV0d29ya1RyYWRl?=
Guest
Posts: n/a
 
      1st Nov 2006
one method to clear the value from the query you can close and reopen the
query in the background....
--
NTC


"Niniel" wrote:

> Hello,
>
> I have a checkbox that when checked makes a textbox visible, and when not
> checked, or unchecked, leaves/makes it invisible.
> People are expected to check the box and then enter text, and on
> AfterUpdate, the content of the checkbox is used to update the form's
> underlying query.
>
> When the texbox is hidden again by unchecking the checkbox, I would like to
> remove the data that was stored in there.
> I can use txtbox.Value = Null to clear the text box, but the data in the
> query isn't touched by this, or if it is, the change is not saved.
>
> What is a good way to delete that information from the db?
>
> Thank you.

 
Reply With Quote
 
=?Utf-8?B?TmluaWVs?=
Guest
Posts: n/a
 
      1st Nov 2006
How do you do that?
I've experimented with an update query, and that seems to work, except I get
a write conflict when I click on a checkbox on another subform right
afterwards.

"NetworkTrade" wrote:

> one method to clear the value from the query you can close and reopen the
> query in the background....
> --
> NTC
>
>
> "Niniel" wrote:
>
> > Hello,
> >
> > I have a checkbox that when checked makes a textbox visible, and when not
> > checked, or unchecked, leaves/makes it invisible.
> > People are expected to check the box and then enter text, and on
> > AfterUpdate, the content of the checkbox is used to update the form's
> > underlying query.
> >
> > When the texbox is hidden again by unchecking the checkbox, I would like to
> > remove the data that was stored in there.
> > I can use txtbox.Value = Null to clear the text box, but the data in the
> > query isn't touched by this, or if it is, the change is not saved.
> >
> > What is a good way to delete that information from the db?
> >
> > Thank you.

 
Reply With Quote
 
Armen Stein
Guest
Posts: n/a
 
      1st Nov 2006
Is there a reason why you are not using a bound form? If it was bound
to your query, any updates to the textbox (including setting it to
Null) would be updated in the query automatically.

On Wed, 1 Nov 2006 09:16:02 -0800, Niniel
<(E-Mail Removed)> wrote:

>Hello,
>
>I have a checkbox that when checked makes a textbox visible, and when not
>checked, or unchecked, leaves/makes it invisible.
>People are expected to check the box and then enter text, and on
>AfterUpdate, the content of the checkbox is used to update the form's
>underlying query.
>
>When the texbox is hidden again by unchecking the checkbox, I would like to
>remove the data that was stored in there.
>I can use txtbox.Value = Null to clear the text box, but the data in the
>query isn't touched by this, or if it is, the change is not saved.
>
>What is a good way to delete that information from the db?
>
>Thank you.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com

 
Reply With Quote
 
=?Utf-8?B?TmluaWVs?=
Guest
Posts: n/a
 
      1st Nov 2006
Yes, there is a reason.
The checkbox is on a continuous subform, and the textbox is on the parent
form.
Both are based on different tables.


"Armen Stein" wrote:

> Is there a reason why you are not using a bound form? If it was bound
> to your query, any updates to the textbox (including setting it to
> Null) would be updated in the query automatically.
>
> On Wed, 1 Nov 2006 09:16:02 -0800, Niniel
> <(E-Mail Removed)> wrote:
>
> >Hello,
> >
> >I have a checkbox that when checked makes a textbox visible, and when not
> >checked, or unchecked, leaves/makes it invisible.
> >People are expected to check the box and then enter text, and on
> >AfterUpdate, the content of the checkbox is used to update the form's
> >underlying query.
> >
> >When the texbox is hidden again by unchecking the checkbox, I would like to
> >remove the data that was stored in there.
> >I can use txtbox.Value = Null to clear the text box, but the data in the
> >query isn't touched by this, or if it is, the change is not saved.
> >
> >What is a good way to delete that information from the db?
> >
> >Thank you.

> Armen Stein
> Microsoft Access MVP
> www.JStreetTech.com
>
>

 
Reply With Quote
 
=?Utf-8?B?TmV0d29ya1RyYWRl?=
Guest
Posts: n/a
 
      1st Nov 2006
in general terms; when you refresh the text box...(i.e. make it invisible
again and change back to null)...this would seem like the right point to
close that query too...

I presume your existing method to open/run of the query will remain
effective....
--
NTC


"Niniel" wrote:

> How do you do that?
> I've experimented with an update query, and that seems to work, except I get
> a write conflict when I click on a checkbox on another subform right
> afterwards.
>
> "NetworkTrade" wrote:
>
> > one method to clear the value from the query you can close and reopen the
> > query in the background....
> > --
> > NTC
> >
> >
> > "Niniel" wrote:
> >
> > > Hello,
> > >
> > > I have a checkbox that when checked makes a textbox visible, and when not
> > > checked, or unchecked, leaves/makes it invisible.
> > > People are expected to check the box and then enter text, and on
> > > AfterUpdate, the content of the checkbox is used to update the form's
> > > underlying query.
> > >
> > > When the texbox is hidden again by unchecking the checkbox, I would like to
> > > remove the data that was stored in there.
> > > I can use txtbox.Value = Null to clear the text box, but the data in the
> > > query isn't touched by this, or if it is, the change is not saved.
> > >
> > > What is a good way to delete that information from the db?
> > >
> > > Thank you.

 
Reply With Quote
 
=?Utf-8?B?TmluaWVs?=
Guest
Posts: n/a
 
      1st Nov 2006
Ok, I've taken your advice and modified it a bit - since I lack the knowledge
to bind my textbox directly to the other table, I put a small hidden textbox
on the continuous subform that IS bound to the corresponding text field in
the query, so when the checkbox is unchecked and the textbox on the parent
form is hidden, the content of the hidden textbox is also set to Null, and
that does clear out the table.
The one potential problem is that the changes don't seem to get written to
the query immediately. When I go to another record they are, but when I move
around the same record, I can't identify reliably what else causes the
changes to be committed to table. Sometimes going to another tab does it,
sometimes it doesn't.

But anyway, thank you very much for providing the inspiration.

"Armen Stein" wrote:

> Is there a reason why you are not using a bound form? If it was bound
> to your query, any updates to the textbox (including setting it to
> Null) would be updated in the query automatically.


 
Reply With Quote
 
Armen Stein
Guest
Posts: n/a
 
      3rd Nov 2006
In article <0F2FDFB4-A757-42B5-B035-(E-Mail Removed)>,
(E-Mail Removed) says...
> The one potential problem is that the changes don't seem to get written to
> the query immediately. When I go to another record they are, but when I move
> around the same record, I can't identify reliably what else causes the
> changes to be committed to table. Sometimes going to another tab does it,
> sometimes it doesn't.
>


Access will commit the changes to the table when you navigate to a
different record, or when you switch between forms (inc. main &
subforms.) So if you click on another tab that contains a different
form, the changes will be committed, but if it is just another tab of
the same form, they won't. I hope that is clearer than it sounds.

--
Armen Stein
Microsoft Access MVP
www.JStreetTech.com

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User form: select all text on text field entry not working Chrisso Microsoft Excel Programming 6 21st Feb 2011 03:09 PM
in a form automatic entry in a text box by entry other field valu ihsan Microsoft Access Forms 1 9th Sep 2008 09:27 PM
CLEAR FIELD TEXT ON CLICK? KLZA Microsoft Excel Programming 3 21st May 2008 05:54 PM
Select all text on entry in a field - can be disabled at application's (or better field) level? Bogdan Zamfir Microsoft Access 4 5th Mar 2004 06:08 PM
Linking date field to text field entry Trey Microsoft Access Forms 1 16th Jul 2003 08:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:38 PM.