0
votes

I have written the following code on click of a button in a Form, which should return current screen size in Ms-Access

Option Compare Database

Declare Function GetSystemMetrics32 Lib "User32" _
    Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long


Private Sub Command0_Enter()


Dim w As Long, h As Long
    w = GetSystemMetrics32(0) ' width in points
    h = GetSystemMetrics32(1) ' height in points

End Sub

I am getting the following error:

The expression On Open you entered as the event property setting produced the following error: Only comments may appear after End Sub, End Function or end property

enter image description here

1

1 Answers

0
votes

Your Declare Function statement needs to be outside (above) Private Sub Command0_Enter().