I need to add some accrual information residing in the TATM1030 tro the EmployeeChecksOtherL. I was going to try to use VBA. I am getting error 424 on the initial connection. This form only has a body and I think it has something to do with section in which the code resides. What am I missing here. This connection technique works on other forms. This is the first time I have tried it with a report.
Private Sub Report_BeforeBody(SuppressBand As Boolean)
If EmployeeID = "" Then Exit Sub
'Get the hours accrued and hours available from the time and attendance table
cmd.CommandText = "SELECT [HOURS_I],[HOURSAVAILABLE_I] FROM [UPR10208] T1 INNER JOIN [TATM1030] T2 ON T1.EMPLOYID=T2.EMPID_I='" & EmployeeID & "'"
Set rst = cmd.Execute
cPTOEarned = rst!HOURS_I
cPTOUsed = rst!HOURSAVAILABLE_I
End Sub
Private Sub Report_End()
'Release the objects we created
Set rst = Nothing
Set cmd = Nothing
Set cn = Nothing
End Sub
Private Sub Report_Start()
'Return an open ADO connection object using the credentials of the GP user logged into the current session
Set cn = UserInfoGet.CreateADOConnection
'Set the Default Database property to the company for the current session
cn.DefaultDatabase = UserInfoGet.IntercompanyID
'Setup to command object so it is ready for use
cmd.ActiveConnection = cn
cmd.CommandType = adCmdText
End Sub
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,522 Super User 2024 Season 2
Martin Dráb 228,441 Most Valuable Professional
nmaenpaa 101,148