Cannot edit textbox after saving record

P

psilva

I'm using a form with unbound textboxes to store info on my database,
to save information i've defined a save button which copies de
contents of the textboxes to the records (i do this to control the
information i edit on the form).

After this, i need to clear all textboxes in order to alloe the user
to enter new information. I've used textbox.text="",
textbox.text=null, textbox.value="", etc, but even though the
textboxes loose their contents, i cannot re-enter information on
them... they act as if they don't allow me to enter information.

Can someone help me on this?

Thanks

Pedro
 
M

Marshall Barton

psilva said:
I'm using a form with unbound textboxes to store info on my database,
to save information i've defined a save button which copies de
contents of the textboxes to the records (i do this to control the
information i edit on the form).

After this, i need to clear all textboxes in order to alloe the user
to enter new information. I've used textbox.text="",
textbox.text=null, textbox.value="", etc, but even though the
textboxes loose their contents, i cannot re-enter information on
them... they act as if they don't allow me to enter information.


You probably have some code in the control's Before/After
Update or Change events that's getting in the way. Normally
that would not be an ussue, but those events are triggered
because you are using the .Text property.

The first thing you need to do is stop using the .Text
property. While that may be the right way to set values in
a VB form, it is definitely not appropriate in an Access
form. (Access' .Text property is only useful in some
esoteric situations.)

You need to use the .Value property, which, since it's the
default property, does not need to be specified explicitly.

Try using:
textbox = Null
or, redundantly:
textbox.Value = Null
or, a little more formally:
Me.textbox = Null
or, if you want the whole show:
Me.textbox.Value = Null

Make those changes and re-evaluate your situation.
 
P

psilva

Thank you for your answer

I have rechecked my code.

I've removed all my .text references, but it didn't solve the problem.

I've got code under the OnChange section which is important to
populate a listbox that runs a query to find immediatelly a match
on the database, which could be creating the problem, but i've also
removed it and the problem remains... can't understand what's
happening.




_____________________________________________________________________
 
M

Marshall Barton

psilva said:
I have rechecked my code.

I've removed all my .text references, but it didn't solve the problem.

I've got code under the OnChange section which is important to
populate a listbox that runs a query to find immediatelly a match
on the database, which could be creating the problem, but i've also
removed it and the problem remains... can't understand what's
happening.


The Change event?? That's one of the few places where the
..Text property is appropriate. What are you trying to do
with that, simulate a combo box's AutoExpand feature?

At this point, I can't guess what else might be preventing
the text box from being edited. I think I need to see your
code for the text box's various events and maybe even any
ither code that interacts with the text box.
 
P

psilva

Thank you for your help.

I finally understood what was going on... it was a rookie mistake, but
it
had never happened to me.

Just for the record, the problem was the following:

When i created the form, i based it on one table of the BD,
afterwards
i decided that it was the wrong way to populate the database, so i
created a button to save records using unbound textboxes.

The problem was that everytime i saved one record and tried to delete
the unbound textboxes, the form kept the reference to the current
record
instead of jumping to next record. So i had to force a "Next record"
on the
form in order to make the unboound textboxes available.

Thanks



Marshall Barton escreveu:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top