Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB v. VBA (.move)

Status
Not open for further replies.

ppedersen1

Technical User
Oct 14, 2002
43
US
For Command1.Click the following works in VB 6:

Private Sub Command1_Click()
Image1.Move Image1.Left + 100
Image2.Move Image2.Left - 100
End Sub

Why doesn't the same syntax work in VBA? What is the correct way?

Thanks.
 
Hi,

Your code above actually moves it, then moves it back.
i.e. no effect.

In Access VBA you'd do this to move it...

image1.left = image1.left + 100

or...

image1.top = image1.top + 100

or....

image1.left = image1.left + 100
image1.top = image1.top + 100

There is no 'Move' method in Access VBA for an image.


Regards,

Darrylles
"Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Your syntax should work in VBA.
Assumed that:
- the command button name is Command1,
- Picture1, Picture2 and Command1 are on the same user form or sheet,
- the code is in the object's (user form, sheet) module.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top