I got it to work on the Chart of Accounts screen; try this:
Private Sub Form1_Load()
Dim Security$, MessPrompt$, MessTitle$, Password$
Password = "test"
MessPrompt = "Enter password to open screen."
MessTitle = "Password Required."
Security = PasswordBox$(MessPrompt, MessTitle)
If Trim$(Security) <> "" Then
If LCase(Security) <> Password Then
MsgBox "Invalid Password.", vbOKOnly, MessTitle
retval = ErrNoMess
Call Edit_Close
End If
Else
MsgBox "Password is required to open this screen.", vbOKOnly, MessTitle
retval = ErrNoMess
Call Edit_Close
End If
End Sub
Also, you'll need to add a "VBA_Aux" code module with the following code:
' *******************************************************************
' * WARNING!!! - Do NOT modify any code in this module. This code *
' * has been auto-generated and any modifications may *
' * cause undesired results. *
' *******************************************************************
Public Declare Function PasswordBox Lib "sbltovba.dll" (ByVal szPrompt As String, Optional ByVal szTitle As String, Optional ByVal szDefault As String, Optional ByVal xPos As Long = -1, Optional ByVal yPos As Long = -1) As String
Public Declare Function GetField Lib "sbltovba.dll" (ByVal szString As String, ByVal iFieldNum As Integer, ByVal szSepChars As String) As String
Public Declare Function SetField Lib "sbltovba.dll" (ByVal szString As String, ByVal iFieldNum As Integer, ByVal szField As String, ByVal szSepChars As String) As String
Public Declare Function GetAccelerator Lib "sbltovba.dll" (ByVal szString As String) As String
Public Declare Function GetCaption Lib "sbltovba.dll" (ByVal szString As String) As String
Public Declare Function ConvertX Lib "sbltovba.dll" (ByVal xVal As Long, Optional ByVal lFlag As Long = 0) As Long
Public Declare Function ConvertY Lib "sbltovba.dll" (ByVal yVal As Long, Optional ByVal lFlag As Long = 0) As Long
Public Declare Function Clipboard_GetText Lib "sbltovba.dll" () As String
Public Declare Sub Clipboard_SetText Lib "sbltovba.dll" (ByVal szString As String)
Public Declare Function Clipboard_Clear Lib "sbltovba.dll" () As Boolean
Public Declare Function Clipboard_GetFormat Lib "sbltovba.dll" (ByVal iFormat As Integer) As Boolean