473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

text box position on form

I'd like to change the top margin of a text box based on a State
Field.

If the state is LA I want the box to appear 1" from the top, if it's
CA I want it to appear 2" from the top. I was trying code similar to
this but was not having success. Any ideas are appreciated.

If State = "LA" Then
lablename.Move
Top:=1
End If
Nov 13 '05 #1
1 8142
Hi,

Put the code in the "On Current" event of the form (if it's not there
already), and use "Me!X" where X is the name of the control, e.g.
"Me!State.Value".

The numbers you're using are probably the main problem. I think that in
VBA code a number setting for a height, width, top etc. is in a unit
called "twips". I can't find any help on twips in Access 97, but the
newsgroups archives are probably a good source for advice on them. Try
multiplying the measurement in inches by 1440 to get twips (although I
think that is dependent on your screen resolution - 1440 works for me at
1040x768).

Try this code in the "On Current" event of your form:
------------
Private Sub Form_Current()

If Me!State.Value = "LA" Then
Me!State.Top = 1446
Else
Me!State.Top = 2886
End If

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

(Note that this won't work if you CHANGE the current record; let me know
if you want help getting that to work.)

------------
LoopyNZ
------------

======================
Original Message:

From: mar10a
Date Posted: 9/15/2004 9:13:00 AM

I'd like to change the top margin of a text box based on a State
Field.

If the state is LA I want the box to appear 1" from the top, if it's
CA I want it to appear 2" from the top. I was trying code similar to
this but was not having success. Any ideas are appreciated.

If State = "LA" Then
lablename.Move
Top:=1
End If

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: AP | last post by:
I am trying to find the integer value for the cursor position in a text box, in particular I want to find out if I am at the end of some text that I typed or at the beginning. I am using IE 6. ...
4
by: anatushi | last post by:
Hi, im looking for help on how to add a text fader to my website, usually i'm working with css but in this case i need to add java script to make it work, that wasn't the problem but somehow it...
2
by: charlie_M | last post by:
I have the following code: <script type=text/javascript> function hide_tooltip(){ var hp = document.getElementById("tooltipper"); hp.style.left=0; hp.style.top=0; hp.style.width=1;...
2
by: Joe Delphi | last post by:
Hi, I want to position label text so that it always appears centered when the user re-sizes the browser window. I tried adding the HTML property text-align="CENTER" to the code, but ASP.NET...
2
by: george.leithead | last post by:
Hi all, I have a very strange problem! In following Web page (which is generated from a CMS System), the navigation to the left 'dissapears' when you roll the mouse over the links? It does not...
1
by: AA Arens | last post by:
On the main form I choosed a position (like manager, secretary...) from a combo box. The field in the footer form of another form mentioned the ID of the position. How to have the position TEXT...
2
by: vinit_mahajan99 | last post by:
Hello all, I want to align the images and controls at the bottom of a master page or at the right side. I tried to do it with the table but I was not successful. The image should be seen at...
7
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post by:
I want to change the font color and weight at a specific position in the text. I am not sure where or what I need to do. It will be at position 155/156 from the left on each line. Here is the...
15
by: Matthew | last post by:
Hi, I'm mainly a coder, PHP at the moment, but from time to time need to design and use some css. I've a css text alignment issue. Mostly to align text neatly in the past I've used tables....
1
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.