Continuous subform behavior

G

george 16-17

Greetings all,

I have a continuous subform on an unbound form that I want to be able to
edit records. When I click into to a text box on the subform and begin to
edit the text, I can edit, but the original text gets deleted as soon as I
start typing. The record is not deleted, just the data in the field linked to
the text box. The form's data entry and allows additions are set to "no" and
allow edits and deletions are set to "yes".

I would like to be able to click into the textbox and freely edit without
the original data being deleted. Any ideas what I am doing wrong? Let me
know if more info is needed.

Thanks in advance and any info is appreciated,
george
 
M

Marshall Barton

george said:
I have a continuous subform on an unbound form that I want to be able to
edit records. When I click into to a text box on the subform and begin to
edit the text, I can edit, but the original text gets deleted as soon as I
start typing. The record is not deleted, just the data in the field linked to
the text box. The form's data entry and allows additions are set to "no" and
allow edits and deletions are set to "yes".

I would like to be able to click into the textbox and freely edit without
the original data being deleted. Any ideas what I am doing wrong? Let me
know if more info is needed.


For tabbing into the text box, you can set an option in the
Tools - Options - Keyboard - entering field menu item.

For mouse clicking into the text box, the normal behavior is
what you want. That makes me think that you have done
something to select all the text, probably in the Enter or
GotFocus event. If you can find some code in the text box's
events that sets the text box's SelStart and SelLength
properties, try removing it.
 
G

george 16-17

Hi Marsh,

I appreciate your reply. The only event I have is On Dirty for the subform.
When the record gets dirty, other text boxes for that record are filled.
Would that be causing this behavior? I must admit, I have only used read only
contuniuous forms in my limit experience with Access.

Thanks again,
george
 
A

Al Campagna

George,
Did you check out Marshall's Tools/Options/Keyboard setting?

Does this only happen with this specific subform?Unlock some other subs and see if they behave similarly.

But...
Make sure you don't double click as you place the cursor in the
text control.
Single click should place the cursor where you clicked
within the exisiting string/value.
Double clicking into a text control selects all.

Also, single clicking the text control's associated (connected) label
will
cause the cursor to enter the text control, and select all the data. Make
sure the label is out of the way of the text control.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
M

Marshall Barton

Al said:
George,
Did you check out Marshall's Tools/Options/Keyboard setting?

Does this only happen with this specific subform?
Unlock some other subs and see if they behave similarly.

But...
Make sure you don't double click as you place the cursor in the
text control.
Single click should place the cursor where you clicked
within the exisiting string/value.
Double clicking into a text control selects all.

Also, single clicking the text control's associated (connected) label
will
cause the cursor to enter the text control, and select all the data. Make
sure the label is out of the way of the text control.


Excellent points Al. You made me think of a situation where
a user had some weird settings in Control Panel - Mouse that
did a double click event on a single click. Made for all
kinds of strange happenings when I tried to debug something
on his machine. I don't remember if/how that impacted
Access form controls though.
 
G

george 16-17

Hi Al and Marsh,

Thanks again for assisting - much appreciated.

Yes, it only happens with this subform. I took your advice to unlock a
continuous form in another db, and it behaves as expected (able to edit
without the original text being completely deleted), so I do not think it is
a setting on the computer or with Access (I tried it on two different
computers).

I think the problem lies within the On Dirty event. Once I deleted the
event, the editing on the problem subform was solved - it did not delete all
of the text upon typing. Here is the code:

Private Sub Form_Dirty(Cancel As Integer)
Me.txtApptDate = Me.Parent("Box2")
Me.txtProfID = Me.Parent("cboProf")
End Sub

Should I place it on another event?

Thanks again and apologize for not explaining this better orginally,
goerge
 
M

Marshall Barton

george said:
Yes, it only happens with this subform. I took your advice to unlock a
continuous form in another db, and it behaves as expected (able to edit
without the original text being completely deleted), so I do not think it is
a setting on the computer or with Access (I tried it on two different
computers).

I think the problem lies within the On Dirty event. Once I deleted the
event, the editing on the problem subform was solved - it did not delete all
of the text upon typing. Here is the code:

Private Sub Form_Dirty(Cancel As Integer)
Me.txtApptDate = Me.Parent("Box2")
Me.txtProfID = Me.Parent("cboProf")
End Sub

Should I place it on another event?


Well, I have no idea why that code would have the effect you
are asking about. But, I would use the subform's Current
event to set the control's DefaultValue property to deal
with new records:

Me.txtApptDate.DefaultValue = Format(Me.Parent.Box2.
"\#yyyy-m-d\#")
Me.txtProfID.DefaultValue = """" & Me.Parent.cboProf &
""""
For existing records that are being edited, I'm not at all
clear about why you want to do anything. Maybe you can use
the form's BeforeUpdate event to deal both new ans edited
existing records?
 
G

george 16-17

Hi Marsh,

Again, I appreciate your persistance.

I think I may have figured it out with your help. I place the code on the
text's box after update event. Now I can edit freely without the original
being deleted all together and it saves the edits.

Thanks again,
george
 

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