By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,359 Members | 1,296 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,359 IT Pros & Developers. It's quick & easy.

RTF2 Report (across multiple pages)

P: n/a
How can I make sure that the page doesn't cut off the rest of my line
or image?

Right now it prints an image toward the bottom of the page and cuts
that image in half and places the rest of it on the next page.

Then I modified the document to place the image higher. Now it takes
the text from the last line of the first page (shown correctly and
fully on the previous page) and shows the bottom half of that sentence
on the next page.

Yes, I'm using the supplied code to deal with this but it's not
working like I expected.

Christian

May 25 '07 #1
Share this Question
Share on Google+
9 Replies

P: n/a
And I guess while I'm asking this - how is SelStart used?

I'm attempting to use it to paste text. I use the same code in a memo
text box, so I know it works. It seems that there's a discrepancy
between where it says the cursor is and where it actually is with the
underlying formatting.

The result is that I can't simply add an offset to the location and
expect it to appear at the correct position all the time.
Christian

May 25 '07 #2

P: n/a
For posterity (responding to myself):

In order to get the pages to print without cutting text off across
pages I simply made each record as a page in the document.

I still have no solution for dealing with SelStart in the document.

The code worked on a text box but doesn't with RTF2:
----------------
Private Sub List3_Click()
On Error Resume Next
Dim sdd As String
Dim rgt As String
Dim lft As String
Dim QWE As Integer

If LostFocusPos = 0 Then
QWE = BeforeUpdatePos
Else
QWE = LostFocusPos
End If

sdd = Me.RTF22.Text

lft = Left(sdd, QWE)
rgt = Right(sdd, Len(sdd) - Len(lft))
Me.RTF22.Text = lft & "" & Me.List3 & "" & rgt

End Sub
-------------------

There are numerous formatting fields that SelStart seems to ignore.

Christian

May 29 '07 #3

P: n/a
Lets' go back to the start on your SelStart issue. What is it you need to do
at runtime using the SelStart method?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
<ch************@yahoo.comwrote in message
news:11*********************@o5g2000hsb.googlegrou ps.com...
For posterity (responding to myself):

In order to get the pages to print without cutting text off across
pages I simply made each record as a page in the document.

I still have no solution for dealing with SelStart in the document.

The code worked on a text box but doesn't with RTF2:
----------------
Private Sub List3_Click()
On Error Resume Next
Dim sdd As String
Dim rgt As String
Dim lft As String
Dim QWE As Integer

If LostFocusPos = 0 Then
QWE = BeforeUpdatePos
Else
QWE = LostFocusPos
End If

sdd = Me.RTF22.Text

lft = Left(sdd, QWE)
rgt = Right(sdd, Len(sdd) - Len(lft))
Me.RTF22.Text = lft & "" & Me.List3 & "" & rgt

End Sub
-------------------

There are numerous formatting fields that SelStart seems to ignore.

Christian
May 29 '07 #4

P: n/a
On May 29, 5:01 pm, "Stephen Lebans" <ForEmailGotoMy.WebSite.-
WWWdotlebansdot...@linvalid.comwrote:
Lets' go back to the start on your SelStart issue. What is it you need to do
at runtime using the SelStart method?
I have a list box of the fields in a selected table or query. When I
place the cursor in the RTF and click on a field in the listbox I want
the fields name (with brackets) placed where my last cursor position
was.

I'm basically making a mail merge field inside access. I then have a
routine that finds the field and replaces it with the field value of
the selected record.

Thanks,

Christian
May 29 '07 #5

P: n/a
It's been years since I wrote this but I think you would use the SelText
prop. THe last place you clicked in the control is automatically the current
insertion point. If that does not work then just do a GoogleGroups search
on:
RTF control insert text visual basic

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
<ch************@yahoo.comwrote in message
news:11**********************@h2g2000hsg.googlegro ups.com...
On May 29, 5:01 pm, "Stephen Lebans" <ForEmailGotoMy.WebSite.-
WWWdotlebansdot...@linvalid.comwrote:
>Lets' go back to the start on your SelStart issue. What is it you need to
do
at runtime using the SelStart method?

I have a list box of the fields in a selected table or query. When I
place the cursor in the RTF and click on a field in the listbox I want
the fields name (with brackets) placed where my last cursor position
was.

I'm basically making a mail merge field inside access. I then have a
routine that finds the field and replaces it with the field value of
the selected record.

Thanks,

Christian


May 30 '07 #6

P: n/a
On May 29, 7:23 pm, "Stephen Lebans" <ForEmailGotoMy.WebSite.-
WWWdotlebansdot...@linvalid.comwrote:
It's been years since I wrote this but I think you would use the SelText
prop. THe last place you clicked in the control is automatically the current
insertion point. If that does not work then just do a GoogleGroups search
on:
RTF control insert text visual basic
Yup, that was it.

Me.RTF22.SelText = lft & "" & Me.List3 & "" & rgt

works.

Why it works I don't know, but whatever.

Thank you Steve!

Christian

May 30 '07 #7

P: n/a
On May 30, 10:45 am, christianlo...@yahoo.com wrote:
Me.RTF22.SelText = lft & "" & Me.List3 & "" & rgt
It will also work simply as:

Me.RTF22.SelText = "" & Me.List3 & ""

Now, if I could set the back color of that text to gray, it would look
just like a ms word merge field, however:

Me.RTF22.SelFontBold = True
Me.RTF22.SelText = "" & Me.List3 & ""
Me.RTF22.SelFontBold = False

doesn't work. And certainly:

Me.RTF22.SelFontBackColor = vbBlue
Me.RTF22.SelText = "" & Me.List3 & ""

doesn't either.

Christian

May 30 '07 #8

P: n/a
You need to search online for VB code showing you how to accomplish your
task.

Set SelStart cursor position(or accept current cursor position)
Set SleLength(how many consecutive characters will your property mods apply
to).
Set desired formatting props
That's it. You just have the order of implementation incorrect.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
<ch************@yahoo.comwrote in message
news:11*********************@m36g2000hse.googlegro ups.com...
On May 30, 10:45 am, christianlo...@yahoo.com wrote:
Me.RTF22.SelText = lft & "" & Me.List3 & "" & rgt
It will also work simply as:

Me.RTF22.SelText = "" & Me.List3 & ""

Now, if I could set the back color of that text to gray, it would look
just like a ms word merge field, however:

Me.RTF22.SelFontBold = True
Me.RTF22.SelText = "" & Me.List3 & ""
Me.RTF22.SelFontBold = False

doesn't work. And certainly:

Me.RTF22.SelFontBackColor = vbBlue
Me.RTF22.SelText = "" & Me.List3 & ""

doesn't either.

Christian
May 31 '07 #9

P: n/a
On May 30, 7:41 pm, "Stephen Lebans" <ForEmailGotoMy.WebSite.-
WWWdotlebansdot...@linvalid.comwrote:
You need to search online for VB code showing you how to accomplish your
task.

Set SelStart cursor position(or accept current cursor position)
Set SleLength(how many consecutive characters will your property mods apply
to).
Set desired formatting props

That's it. You just have the order of implementation incorrect.
Yes, I found that out. It's hard to find examples though.

Now I know how to make the selection bold, italics and change the font
size. What is not working are the selection colors:

Me.RTF23.SelText = "" & Me.List6 & ""
Me.RTF23.SelStart = Selection
Me.RTF23.SelLength = Len(Me.List6) + 2
'Me.RTF23.SelFontItalic = True 'WORKS
Me.RTF23.SelBackColor = vbRed 'DOES NOT WORK

No big deal. I'm currently working on the find/replace code to
substitute the fields with records. I wanted the Replace function to
work but I might have to use the RTF2 Find function.

Christian
May 31 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.