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

text box position on form

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.