UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Use VBA To Set Margin For Textbox, Access 2010    
 
   
ZippyThePinhead
post Dec 24 2017, 01:46 PM
Post#1



Posts: 45
Joined: 11-December 17



Is there any way to set the margins of a textbox with VBA so that the space to the left of left-aligned text can change on the fly?

I've tried Me!controlname.LeftMargin = variablename and, though it passes debug, it doesn't actually do anything. In the immediate window, the margin shows the correct value, but the text stays aligned to the extreme left of the control. I had the same result using the left padding setting
Go to the top of the page
 
moke123
post Dec 24 2017, 03:20 PM
Post#2



Posts: 1,282
Joined: 26-December 12
From: Western Ma.,L.I.,N.Y.,Jupiter,Fl.



if its rich text you can use html markup or regular text you can concatenate spaces, i.e.- space(5) & "x..." ,space(10) & "X..."
Go to the top of the page
 
GroverParkGeorge
post Dec 25 2017, 10:33 AM
Post#3


UA Admin
Posts: 33,016
Joined: 20-June 02
From: Newcastle, WA


Not having had a need to do this, I don't have an answer ready. I'm curious about a couple of things. 1) why? What's the objective? How will this impact your users' ability to work with the application? 2) can you adjust this in design view directly? I know that's not what you want, but as a proof of concept, could you achieve the desired effect by changing those properties?

What event did you use? I would imagine this would have to be on the form's Current event to be effective? And that brings up another question, is the form in continuous view or normal view when you need to do this?

--------------------
Go to the top of the page
 
ZippyThePinhead
post Dec 25 2017, 03:28 PM
Post#4



Posts: 45
Joined: 11-December 17



It's an attempt to create a scroll feature. The alternative was to add a bunch of blank spaces to the left of the text and then remove them one at a time. That works, but I was just trying to come up with another approach.
Go to the top of the page
 
GroverParkGeorge
post Dec 25 2017, 05:48 PM
Post#5


UA Admin
Posts: 33,016
Joined: 20-June 02
From: Newcastle, WA


Scroll? I see. Textbox controls have a vertical scroll built-in, but don't support horizontal scrolling, which is what you would need.

But even if we can figure out a way to change the internal margin with VBA, you have two remaining, albeit related, problems. No horizontal scroll bar and no method by which to "trigger" the scrolling action.

Is it possible to use the "Can Grow" property to allow this control to grow vertically, as needed, to display all of the contents in it?

--------------------
Go to the top of the page
 
moke123
post Dec 25 2017, 08:49 PM
Post#6



Posts: 1,282
Joined: 26-December 12
From: Western Ma.,L.I.,N.Y.,Jupiter,Fl.



QUOTE
It's an attempt to create a scroll feature. The alternative was to add a bunch of blank spaces to the left of the text and then remove them one at a time.

Do you mean like a scrolling Marquee?

you can do that easily with a web browser control and an html file.

open a text file and enter ...
CODE
<!DOCTYPE html>
<marquee behavior="scroll" direction="Left">Your scrolling text goes here</marquee>

save it and rename it with an .html extension.
then set the web browser control source to the path to the html file.
Go to the top of the page
 
missinglinq
post Dec 25 2017, 09:25 PM
Post#7



Posts: 4,510
Joined: 11-November 02



"Can Grow" only applies to printing...either Reports or the (ill-advised) printing of Forms...unless something has changed in recent versions.

As is often the case, Lebans has a hack for scrolling:

http://www.lebans.com/hscroller.htm

Linq ;0)>

--------------------
Hope this helps!

The problem with making anything foolproof...is that fools are so darn ingenious!

All posts/responses based on Access 2003/2007
Go to the top of the page
 
ZippyThePinhead
post Dec 27 2017, 10:53 PM
Post#8



Posts: 45
Joined: 11-December 17



moke123:

This sounds interesting, but I don't understand your instructions. How would I put this into a form?
Go to the top of the page
 
moke123
post Dec 27 2017, 11:54 PM
Post#9



Posts: 1,282
Joined: 26-December 12
From: Western Ma.,L.I.,N.Y.,Jupiter,Fl.



here...Attached File  Marquee.zip ( 20.75K )Number of downloads: 4
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    17th July 2018 - 01:54 PM