PC Review


Reply
Thread Tools Rate Thread

Changing font in rich text table

 
 
anthony
Guest
Posts: n/a
 
      19th Apr 2010
I want to standardise the font of all data in a table's rich text
field. If I use:

Dim DB As Database
Dim rst As Recordset
Dim strSQL As String
Set DB = CurrentDb()
strSQL = "SELECT tblReportTermly.Aims FROM tblReportTermly;"
Set rst = DB.OpenRecordset(strSQL)
Do Until rst.EOF
With rst
.MoveFirst
.Edit
!Aims.FontName = "Calibri"
!Aims.FontSize = "11"
.Update
.MoveNext
End With
Loop

i get "Object doesn't support this property or method". Am I
approaching this incorrectly?
 
Reply With Quote
 
 
 
 
Tom van Stiphout
Guest
Posts: n/a
 
      19th Apr 2010
On Mon, 19 Apr 2010 06:46:47 -0700 (PDT), anthony
<(E-Mail Removed)> wrote:

The reason for the error is that a field in a recordset doesn't have a
FontName property. It didn't show in intellisense either.
Rather you have to change the Value of this field:
..Edit
!Aims = ReplaceFontInfo(!Aims)
..Update

Now you write this function to do the actual work:
private function ReplaceFontInfo(byval s as string) as string
'TODO: Use Replace function and others to do the work, thus changing
s.
ReplaceFontInfo = s
end function

I'd have to see what the value s looks like before I could give more
suggestions. This may be difficult to fix in the general case.

-Tom.
Microsoft Access MVP



>I want to standardise the font of all data in a table's rich text
>field. If I use:
>
>Dim DB As Database
>Dim rst As Recordset
>Dim strSQL As String
>Set DB = CurrentDb()
>strSQL = "SELECT tblReportTermly.Aims FROM tblReportTermly;"
>Set rst = DB.OpenRecordset(strSQL)
>Do Until rst.EOF
> With rst
> .MoveFirst
> .Edit
> !Aims.FontName = "Calibri"
> !Aims.FontSize = "11"
> .Update
> .MoveNext
> End With
>Loop
>
>i get "Object doesn't support this property or method". Am I
>approaching this incorrectly?

 
Reply With Quote
 
anthony
Guest
Posts: n/a
 
      19th Apr 2010
On Apr 19, 2:56*pm, Tom van Stiphout <tom7744.no.s...@cox.net> wrote:
> On Mon, 19 Apr 2010 06:46:47 -0700 (PDT), anthony
>
> <anthony.marr...@gmail.com> wrote:
>
> The reason for the error is that a field in a recordset doesn't have a
> FontName property. It didn't show in intellisense either.
> Rather you have to change the Value of this field:
> .Edit
> !Aims = ReplaceFontInfo(!Aims)
> .Update
>
> Now you write this function to do the actual work:
> private function ReplaceFontInfo(byval s as string) as string
> 'TODO: Use Replace function and others to do the work, thus changing
> s.
> ReplaceFontInfo = s
> end function
>
> I'd have to see what the value s looks like before I could give more
> suggestions. This may be difficult to fix in the general case.
>
> -Tom.
> Microsoft Access MVP
>
> >I want to standardise the font of all data in a table's rich text
> >field. If I use:

>
> >Dim DB As Database
> >Dim rst As Recordset
> >Dim strSQL As String
> >Set DB = CurrentDb()
> >strSQL = "SELECT tblReportTermly.Aims FROM tblReportTermly;"
> >Set rst = DB.OpenRecordset(strSQL)
> >Do Until rst.EOF
> > * *With rst
> > * * * *.MoveFirst
> > * * * *.Edit
> > * * * *!Aims.FontName = "Calibri"
> > * * * *!Aims.FontSize = "11"
> > * * * *.Update
> > * *.MoveNext
> > * *End With
> >Loop

>
> >i get "Object doesn't support this property or method". Am I
> >approaching this incorrectly?


Thank you Tom. I had a horrid feeling it was going to be complicated!

Best - Anthony
 
Reply With Quote
 
anthony
Guest
Posts: n/a
 
      19th Apr 2010
On Apr 19, 2:56*pm, Tom van Stiphout <tom7744.no.s...@cox.net> wrote:
> On Mon, 19 Apr 2010 06:46:47 -0700 (PDT), anthony
>
> <anthony.marr...@gmail.com> wrote:
>
> The reason for the error is that a field in a recordset doesn't have a
> FontName property. It didn't show in intellisense either.
> Rather you have to change the Value of this field:
> .Edit
> !Aims = ReplaceFontInfo(!Aims)
> .Update
>
> Now you write this function to do the actual work:
> private function ReplaceFontInfo(byval s as string) as string
> 'TODO: Use Replace function and others to do the work, thus changing
> s.
> ReplaceFontInfo = s
> end function
>
> I'd have to see what the value s looks like before I could give more
> suggestions. This may be difficult to fix in the general case.
>
> -Tom.
> Microsoft Access MVP
>
> >I want to standardise the font of all data in a table's rich text
> >field. If I use:

>
> >Dim DB As Database
> >Dim rst As Recordset
> >Dim strSQL As String
> >Set DB = CurrentDb()
> >strSQL = "SELECT tblReportTermly.Aims FROM tblReportTermly;"
> >Set rst = DB.OpenRecordset(strSQL)
> >Do Until rst.EOF
> > * *With rst
> > * * * *.MoveFirst
> > * * * *.Edit
> > * * * *!Aims.FontName = "Calibri"
> > * * * *!Aims.FontSize = "11"
> > * * * *.Update
> > * *.MoveNext
> > * *End With
> >Loop

>
> >i get "Object doesn't support this property or method". Am I
> >approaching this incorrectly?


Alright, so I grab the value of the field (which will be a couple of
sentences of text), format it and then replace the contents of aims
with it. The question is: what syntax do I need to use to give the
variable's contents a font and a font size before replacing the
current contents of aims? Actually, I wonder whether I could put the
whole table into Excel, format it there and then re-populate...
 
Reply With Quote
 
Tom van Stiphout
Guest
Posts: n/a
 
      20th Apr 2010
On Mon, 19 Apr 2010 09:29:28 -0700 (PDT), anthony
<(E-Mail Removed)> wrote:

Apply some font and size before saving it to the table in the first
place. Then see what was created.

-Tom.
Microsoft Access MVP


>On Apr 19, 2:56*pm, Tom van Stiphout <tom7744.no.s...@cox.net> wrote:
>> On Mon, 19 Apr 2010 06:46:47 -0700 (PDT), anthony
>>
>> <anthony.marr...@gmail.com> wrote:
>>
>> The reason for the error is that a field in a recordset doesn't have a
>> FontName property. It didn't show in intellisense either.
>> Rather you have to change the Value of this field:
>> .Edit
>> !Aims = ReplaceFontInfo(!Aims)
>> .Update
>>
>> Now you write this function to do the actual work:
>> private function ReplaceFontInfo(byval s as string) as string
>> 'TODO: Use Replace function and others to do the work, thus changing
>> s.
>> ReplaceFontInfo = s
>> end function
>>
>> I'd have to see what the value s looks like before I could give more
>> suggestions. This may be difficult to fix in the general case.
>>
>> -Tom.
>> Microsoft Access MVP
>>
>> >I want to standardise the font of all data in a table's rich text
>> >field. If I use:

>>
>> >Dim DB As Database
>> >Dim rst As Recordset
>> >Dim strSQL As String
>> >Set DB = CurrentDb()
>> >strSQL = "SELECT tblReportTermly.Aims FROM tblReportTermly;"
>> >Set rst = DB.OpenRecordset(strSQL)
>> >Do Until rst.EOF
>> > * *With rst
>> > * * * *.MoveFirst
>> > * * * *.Edit
>> > * * * *!Aims.FontName = "Calibri"
>> > * * * *!Aims.FontSize = "11"
>> > * * * *.Update
>> > * *.MoveNext
>> > * *End With
>> >Loop

>>
>> >i get "Object doesn't support this property or method". Am I
>> >approaching this incorrectly?

>
>Alright, so I grab the value of the field (which will be a couple of
>sentences of text), format it and then replace the contents of aims
>with it. The question is: what syntax do I need to use to give the
>variable's contents a font and a font size before replacing the
>current contents of aims? Actually, I wonder whether I could put the
>whole table into Excel, format it there and then re-populate...

 
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
HTML changing to Rich Text PSULionRP Microsoft Outlook Discussion 8 3rd Nov 2008 09:54 PM
Changing Font / Rich Text Formatting / Merging / Text Fileds =?Utf-8?B?RXJpbkpveQ==?= Microsoft Word Document Management 1 23rd Feb 2007 08:53 PM
Changing default rich text font style Trent SC Microsoft Outlook Discussion 1 25th Nov 2005 02:13 PM
C# WinForm....changing font colors for multi line rich textbox Mr.Baha Microsoft C# .NET 2 28th Jan 2005 08:09 PM
Font on rich text box Franz Microsoft Dot NET Framework 0 13th Mar 2004 06:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:31 PM.