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!