Justifying text in Datasheet view

M

Mark O

Hello,

I have the following:

MyTable consisting of two fields and 3 records:
===============================================
Field 1: MyText Text (50)
Field 2: TextJustify Text (1)

This is text for Record1 L
This is text for Record2 C
This is text for Record3 R

MyMainForm containing MySubform.
MySubform displays MyTable in Datasheet view.

Problem:
I am using a ComboBox for TextJustify to select "L"(i.e. Left),
"C"(Center), & "R"(Right). I want to be able to change TextJustify and
have the text in MyText respond accordingly.

In the example above, Record1 would be Left justified, Record2 would be
Centered, and Record3 would be Right justified.

The Conditional Formating option on the Format menu includes Bold,
Italic, Underline, Enable but not text justifying. Any way to do this?

Thanks in advance.
Mark
 
G

Guest

Hi Mark.

I'm pretty sure this is not possible in a Datasheet. It should be possible
to do in a Report, although not with Conditional Formatting. I realize
that's not what you asked for, but just in case it would help:

For a Report, the following (air) code could be placed in the Format event
of the Report's Detail section:

Select Case Me.TextJustify
Case "L"
Me.txtMyText.TextAlign = 1
Case "C"
Me.txtMyText.TextAlign = 2
Case "R"
Me.txtMyText.TextAlign = 3
End Select

In the above, I have assumed the name of the Control for the MyText Feld is
txtMyText. Replace it with your own Control name, but give it a different
name than the Field. Access 2000, which I'm using, makes the name of a newly
added Control the same as the corresponding Field name, which is a bad idea.

-Michael
 
M

Mark O

Thank you very much for responding, Michael.

In my application I wanted to present 4 lines of text that will be
printed on mailing labels. Ideally I want the user to be able to make
the choice of formatting and see the result immediately. It looks like
your idea will work fine on the actual printing of the labels.

I may be able to purchase a control (an ActiveX grid) from a third party
vendor which provides the desired functionality.

Mark
 
R

Ron2006

If you use a Continuous Form that approximates a datasheet view, then
the

me.fieldname.textalign will work.

Ron
 

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