Hello, I have very little VBA knowledge but have been giving a task which I need some direction. I have the code below that when the button is clicked will populate a window with data that is returned by a stored procedure. This all works great.
What I need to do is only allow the window to be populated if the username of the user logged into great plains also resides in a table on a SQL database.
This is just where I'm at but may not be the best way to accomplish my task. Any comments or ideas would be great!
Here is the code that I use to populate the window.
Private Sub PushButtonM162_AfterUserChanged()
On Error GoTo ErrorHandler
CancelLogic = True
Dim userinfo As New RetrieveGlobals.retrieveuserinfo
Dim adCNN As ADODB.Connection
Dim adrst As ADODB.Recordset
Dim strcmd As String
Dim strCnn As String
Dim response As Variant
sqluid = userinfo.retrieve_user()
sqlpwd = userinfo.sql_password()
SQLdb = userinfo.intercompany_id()
sqlsvr = userinfo.sql_datasourcename()
With CLIN_Filter
.User = sqluid
.password = sqlpwd
.SERVER = sqlsvr
.DataBase = SQLdb
.Filter_Type = "CLIN"
.Height = 7000
.dHeight = 3750
.Width = 8500
.dWidth = 7800
.addSorts = 2
.reportCount = 4
.sp_Name = "csp_ws_lookup_item_clin_Only70"
response = .load_view
CLIN_Filter_RowReturned response
End With
Exit Sub
ErrorHandler:
Exit Sub
End Sub
What I need to do is only allow the window to be populated if the username of the user logged into great plains also resides in a table on a SQL database.
This is just where I'm at but may not be the best way to accomplish my task. Any comments or ideas would be great!
Here is the code that I use to populate the window.
Private Sub PushButtonM162_AfterUserChanged()
On Error GoTo ErrorHandler
CancelLogic = True
Dim userinfo As New RetrieveGlobals.retrieveuserinfo
Dim adCNN As ADODB.Connection
Dim adrst As ADODB.Recordset
Dim strcmd As String
Dim strCnn As String
Dim response As Variant
sqluid = userinfo.retrieve_user()
sqlpwd = userinfo.sql_password()
SQLdb = userinfo.intercompany_id()
sqlsvr = userinfo.sql_datasourcename()
With CLIN_Filter
.User = sqluid
.password = sqlpwd
.SERVER = sqlsvr
.DataBase = SQLdb
.Filter_Type = "CLIN"
.Height = 7000
.dHeight = 3750
.Width = 8500
.dWidth = 7800
.addSorts = 2
.reportCount = 4
.sp_Name = "csp_ws_lookup_item_clin_Only70"
response = .load_view
CLIN_Filter_RowReturned response
End With
Exit Sub
ErrorHandler:
Exit Sub
End Sub