Copy contents of a field does not copy complete field

G

Guest

I have an EventProcedure to go to a field and copy the contents. The first
part copies the text, then the Notify Macro is a Send Object Macro. The idea
is to have the text from the ResumeTXT field in the Clipboards so it can be
pasted into the Message of the Email. I

Trouble is that this either crashes the database, or only copies part of the
field. If I tab out and back into the field, then do the Ctrl-C to copy, all
the text is there when I paste. I have tried running this without the last
RunMacro command and it still does not copy everything when I paste it in
Notepad.

Sometimes the data in the field is long as it is one field and 2 memo fields
concatenated:
ResumeTXT =[NotifyMessage] & Chr$(13) & [coverletter] & Chr$(13) & [Resume]

If I remove one or two of the fields it seems to work - must be an issue
with the length of the text.

I have tried sending a report with these fields using the SendObjects
command but this does not send the complete report either. It inserts a bunch
of returns in the middle of the document and cuts off the end.

I am at a loss. Any ideas greatly appreciated.

-------------

Private Sub CopyField_Click()

ResumeTXT.SetFocus
ResumeTXT.SelStart = 0
ResumeTXT.SelLength = Len(ResumeTXT)

DoCmd.DoMenuItem 1, acEditMenu, 2

DoCmd.RunMacro "Macros.Notify"

End Sub



Thanks!
Sandy
 
S

Steve Schapel

Sandy,

I'm not sure exactly how you are thinking about this. Is ResumeTXT the
name of a textbox? On the same form as the CopyField control? If so, I
don't understand why you are using the SelStart and SelLength methods,
since the SetFocus already will have selected the text in the control.
I am not familiar with DoMenuItem at all, but if you are trying to copy
the contents of the control, here's how I would do it...

Me.ResumeTXT.SetFocus
DoCmd.RunCommand acCmdCopy

And then, since you are using a VBA procedure anyway, why not continue
to use the DoCmd.SendObject method within your procedure, rather than
branching out into a macro?

The other thing is, it is not clear what this refers to...
ResumeTXT =[NotifyMessage] & Chr$(13) & [coverletter] & Chr$(13) &
[Resume]
Do you mean that
=[NotifyMessage] & Chr$(13) & [coverletter] & Chr$(13) & [Resume]
.... is the Control Source of the ResumeTXT textbox?
If so, your reference to Chr$(13) won't work without an associated
Chr(10), i.e....
=[NotifyMessage] & Chr(13) & Chr(10) & [coverletter] & Chr(13) &
Chr(10) & [Resume]

Or do you mean that
ResumeTXT =[NotifyMessage] & Chr$(13) & [coverletter] & Chr$(13) &
[Resume]
.... is a line of code elsewhere within your VBA module? If so, you need
this instead...
Me.ResumeTXT = Me.NotifyMessage & vbCrLf & Me.coverletter & vbCrLf &
Me.Resume

--
Steve Schapel, Microsoft Access MVP
I have an EventProcedure to go to a field and copy the contents. The first
part copies the text, then the Notify Macro is a Send Object Macro. The idea
is to have the text from the ResumeTXT field in the Clipboards so it can be
pasted into the Message of the Email. I

Trouble is that this either crashes the database, or only copies part of the
field. If I tab out and back into the field, then do the Ctrl-C to copy, all
the text is there when I paste. I have tried running this without the last
RunMacro command and it still does not copy everything when I paste it in
Notepad.

Sometimes the data in the field is long as it is one field and 2 memo fields
concatenated:
ResumeTXT =[NotifyMessage] & Chr$(13) & [coverletter] & Chr$(13) & [Resume]

If I remove one or two of the fields it seems to work - must be an issue
with the length of the text.

I have tried sending a report with these fields using the SendObjects
command but this does not send the complete report either. It inserts a bunch
of returns in the middle of the document and cuts off the end.

I am at a loss. Any ideas greatly appreciated.

-------------

Private Sub CopyField_Click()

ResumeTXT.SetFocus
ResumeTXT.SelStart = 0
ResumeTXT.SelLength = Len(ResumeTXT)

DoCmd.DoMenuItem 1, acEditMenu, 2

DoCmd.RunMacro "Macros.Notify"

End Sub



Thanks!
Sandy
 
G

Guest

Thanks, Steve -

This helped.


=====================

=[NotifyMessage] & Chr(13) & Chr(10) & [coverletter] & Chr(13) &
Chr(10) & [Resume]

=====================


.... is the Control Source of the ResumeTXT textbox - I added the Chr(10) to
the code as you sugested.

I converted the Macro to code to generate the SendObject but I am having
trouble with the SendObject line.

Here is the code:

=====================

Private Sub CopyField_Click()


MsgBox "Do Ctrl-V in the body of your email message to paste the cover
letter and resume"

Me.ResumeTXT.SetFocus

DoCmd.RunCommand acCmdCopy

DoCmd.SendObject , "", "", Forms![resumes form].Staff.email,
Forms![resumes form].Staff_1.email & ", (e-mail address removed)", "", "New Resume to
Review", "", True, ""

End Sub


=====================


I tried it without the

& ", (e-mail address removed)"

but still get an error.

Thank you so much.
sandy



Steve Schapel said:
Sandy,

I'm not sure exactly how you are thinking about this. Is ResumeTXT the
name of a textbox? On the same form as the CopyField control? If so, I
don't understand why you are using the SelStart and SelLength methods,
since the SetFocus already will have selected the text in the control.
I am not familiar with DoMenuItem at all, but if you are trying to copy
the contents of the control, here's how I would do it...

Me.ResumeTXT.SetFocus
DoCmd.RunCommand acCmdCopy

And then, since you are using a VBA procedure anyway, why not continue
to use the DoCmd.SendObject method within your procedure, rather than
branching out into a macro?

The other thing is, it is not clear what this refers to...
ResumeTXT =[NotifyMessage] & Chr$(13) & [coverletter] & Chr$(13) &
[Resume]
Do you mean that
=[NotifyMessage] & Chr$(13) & [coverletter] & Chr$(13) & [Resume]
.... is the Control Source of the ResumeTXT textbox?
If so, your reference to Chr$(13) won't work without an associated
Chr(10), i.e....
=[NotifyMessage] & Chr(13) & Chr(10) & [coverletter] & Chr(13) &
Chr(10) & [Resume]

Or do you mean that
ResumeTXT =[NotifyMessage] & Chr$(13) & [coverletter] & Chr$(13) &
[Resume]
.... is a line of code elsewhere within your VBA module? If so, you need
this instead...
Me.ResumeTXT = Me.NotifyMessage & vbCrLf & Me.coverletter & vbCrLf &
Me.Resume

--
Steve Schapel, Microsoft Access MVP
I have an EventProcedure to go to a field and copy the contents. The first
part copies the text, then the Notify Macro is a Send Object Macro. The idea
is to have the text from the ResumeTXT field in the Clipboards so it can be
pasted into the Message of the Email. I

Trouble is that this either crashes the database, or only copies part of the
field. If I tab out and back into the field, then do the Ctrl-C to copy, all
the text is there when I paste. I have tried running this without the last
RunMacro command and it still does not copy everything when I paste it in
Notepad.

Sometimes the data in the field is long as it is one field and 2 memo fields
concatenated:
ResumeTXT =[NotifyMessage] & Chr$(13) & [coverletter] & Chr$(13) & [Resume]

If I remove one or two of the fields it seems to work - must be an issue
with the length of the text.

I have tried sending a report with these fields using the SendObjects
command but this does not send the complete report either. It inserts a bunch
of returns in the middle of the document and cuts off the end.

I am at a loss. Any ideas greatly appreciated.

-------------

Private Sub CopyField_Click()

ResumeTXT.SetFocus
ResumeTXT.SelStart = 0
ResumeTXT.SelLength = Len(ResumeTXT)

DoCmd.DoMenuItem 1, acEditMenu, 2

DoCmd.RunMacro "Macros.Notify"

End Sub



Thanks!
Sandy
 
G

Guest

Also, if there is no Manager2 to use in the CC box, then the second email for
the HR@mycompany gives an error.

I guess I need an IF statmenet there to add the comma before the second
email address only if there is a value in Manager2.

Sandy said:
Thanks, Steve -

This helped.


=====================

=[NotifyMessage] & Chr(13) & Chr(10) & [coverletter] & Chr(13) &
Chr(10) & [Resume]

=====================


... is the Control Source of the ResumeTXT textbox - I added the Chr(10) to
the code as you sugested.

I converted the Macro to code to generate the SendObject but I am having
trouble with the SendObject line.

Here is the code:

=====================

Private Sub CopyField_Click()


MsgBox "Do Ctrl-V in the body of your email message to paste the cover
letter and resume"

Me.ResumeTXT.SetFocus

DoCmd.RunCommand acCmdCopy

DoCmd.SendObject , "", "", Forms![resumes form].Staff.email,
Forms![resumes form].Staff_1.email & ", (e-mail address removed)", "", "New Resume to
Review", "", True, ""

End Sub


=====================


I tried it without the

& ", (e-mail address removed)"

but still get an error.

Thank you so much.
sandy



Steve Schapel said:
Sandy,

I'm not sure exactly how you are thinking about this. Is ResumeTXT the
name of a textbox? On the same form as the CopyField control? If so, I
don't understand why you are using the SelStart and SelLength methods,
since the SetFocus already will have selected the text in the control.
I am not familiar with DoMenuItem at all, but if you are trying to copy
the contents of the control, here's how I would do it...

Me.ResumeTXT.SetFocus
DoCmd.RunCommand acCmdCopy

And then, since you are using a VBA procedure anyway, why not continue
to use the DoCmd.SendObject method within your procedure, rather than
branching out into a macro?

The other thing is, it is not clear what this refers to...
ResumeTXT =[NotifyMessage] & Chr$(13) & [coverletter] & Chr$(13) &
[Resume]
Do you mean that
=[NotifyMessage] & Chr$(13) & [coverletter] & Chr$(13) & [Resume]
.... is the Control Source of the ResumeTXT textbox?
If so, your reference to Chr$(13) won't work without an associated
Chr(10), i.e....
=[NotifyMessage] & Chr(13) & Chr(10) & [coverletter] & Chr(13) &
Chr(10) & [Resume]

Or do you mean that
ResumeTXT =[NotifyMessage] & Chr$(13) & [coverletter] & Chr$(13) &
[Resume]
.... is a line of code elsewhere within your VBA module? If so, you need
this instead...
Me.ResumeTXT = Me.NotifyMessage & vbCrLf & Me.coverletter & vbCrLf &
Me.Resume

--
Steve Schapel, Microsoft Access MVP
I have an EventProcedure to go to a field and copy the contents. The first
part copies the text, then the Notify Macro is a Send Object Macro. The idea
is to have the text from the ResumeTXT field in the Clipboards so it can be
pasted into the Message of the Email. I

Trouble is that this either crashes the database, or only copies part of the
field. If I tab out and back into the field, then do the Ctrl-C to copy, all
the text is there when I paste. I have tried running this without the last
RunMacro command and it still does not copy everything when I paste it in
Notepad.

Sometimes the data in the field is long as it is one field and 2 memo fields
concatenated:
ResumeTXT =[NotifyMessage] & Chr$(13) & [coverletter] & Chr$(13) & [Resume]

If I remove one or two of the fields it seems to work - must be an issue
with the length of the text.

I have tried sending a report with these fields using the SendObjects
command but this does not send the complete report either. It inserts a bunch
of returns in the middle of the document and cuts off the end.

I am at a loss. Any ideas greatly appreciated.

-------------

Private Sub CopyField_Click()

ResumeTXT.SetFocus
ResumeTXT.SelStart = 0
ResumeTXT.SelLength = Len(ResumeTXT)

DoCmd.DoMenuItem 1, acEditMenu, 2

DoCmd.RunMacro "Macros.Notify"

End Sub



Thanks!
Sandy
 

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