Simple If Statement moved to Macro

Tieval

Still Clueless
Local time
Today, 08:14
Joined
Jun 26, 2015
Messages
475
Hi,

I have an open form with buttons to open other forms and use an If statement to position them an example is below.

Code:
Private Sub Command31_Click()
DoCmd.OpenForm "Opener", acNormal
If Me.Frame54 = 1 Then
DoCmd.MoveSize 2500, 1000
ElseIf Me.Frame54 = 2 Then
DoCmd.MoveSize 25500, 1000
End If
End Sub
This works perfectly, however I need to put similar code as a line in a macro and cannot seem to link it.

Code:
Public Function totalmove()
If Forms.Scan_Data.Frame54 = 1 Then
DoCmd.MoveSize 2500, 1000
ElseIf Forms.Scan_Data.Frame54 = 2 Then
DoCmd.MoveSize 24000, 1000
End If
End Function
I get Error 438 object doesn't support this property or method
 
I'm quite new to this world, but i've read that vba is more functional and easy to personalize rather then macro's it self.

So my question is why go from vba to a marco?
 
Easy answer here, I have a long complex function carried out through a macro and rather than code that completely I just want to add a bit of code on the end to do a simple final function.
 

Users who are viewing this thread

Back
Top Bottom