Move forward, move backward

C

Chris

Can anyone tell me if there is code, and what it is, to move a lable forward
and backward?

The lable I have covers stuff I want to see in design, but I only want it on
top when I call for it to be visible. I assume I can make it visible and
make it the most forward item, then when making invisible again putting it in
the back again.

Help? Maybe?
 
M

Marshall Barton

Chris said:
Can anyone tell me if there is code, and what it is, to move a lable forward
and backward?

The lable I have covers stuff I want to see in design, but I only want it on
top when I call for it to be visible. I assume I can make it visible and
make it the most forward item, then when making invisible again putting it in
the back again.


In design view, all the controls are visible so there is no
making it visible/invisible. You can use Format menu -
Bring to Front and Send to Back, but it might be easier to
just use the Tab key to select each control (in the order
they were created). Most likely, the best way to get to a
specific control in a pile of controls is to use the
Formatting toolbar's Object dropdown to select the control
you want to manipulate.
 
B

Brendan Reynolds

Access has Bring To Front and Send To Back commands ...

DoCmd.RunCommand acCmdBringToFront
DoCmd.RunCommand acCmdSendToBack

.... but they can only be used when the form is open in design view.

What you could do, is to make the label small and place it in an out of the
way place in design view, then change it's size and position at run time ...

Private Sub Command3_Click()

'Use this during testing to find the right values for the Move method
below.
Debug.Print Me.Label5.Left, Me.Label5.Top, Me.Label5.Width,
Me.Label5.Height

If Me.Label5.Visible = True Then
Me.Label5.Visible = False
Else
Me.Label5.Visible = True
Me.Label5.Move 226, 283, 4649, 964
End If

End Sub

You don't have to worry about putting it back to the original small size and
out-of-the-way position, as changes like this are not saved anyway when the
form is open in normal form view.
 
C

Chris

Its only a problem for me in design. So...

1. How would I invoke the acCmdSendToBack ? and the counter when finished
designing?

2. Choosing the alternate method, I see what you are doing, but how do I
invoke the command?

I am far from competent with Access, but learning.

--
Thanks for your help,
Chris


Brendan Reynolds said:
Access has Bring To Front and Send To Back commands ...

DoCmd.RunCommand acCmdBringToFront
DoCmd.RunCommand acCmdSendToBack

.... but they can only be used when the form is open in design view.

What you could do, is to make the label small and place it in an out of the
way place in design view, then change it's size and position at run time ...

Private Sub Command3_Click()

'Use this during testing to find the right values for the Move method
below.
Debug.Print Me.Label5.Left, Me.Label5.Top, Me.Label5.Width,
Me.Label5.Height

If Me.Label5.Visible = True Then
Me.Label5.Visible = False
Else
Me.Label5.Visible = True
Me.Label5.Move 226, 283, 4649, 964
End If

End Sub

You don't have to worry about putting it back to the original small size and
out-of-the-way position, as changes like this are not saved anyway when the
form is open in normal form view.
 
B

Brendan Reynolds

In design view, you can just select 'Send to Back' or 'Bring to Front' from
the Format menu.

--
Brendan Reynolds
Access MVP

Chris said:
Its only a problem for me in design. So...

1. How would I invoke the acCmdSendToBack ? and the counter when finished
designing?

2. Choosing the alternate method, I see what you are doing, but how do I
invoke the command?

I am far from competent with Access, but learning.
 

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