Hello group,
I have a user experiencing a runtime error when the Print button is clicked on one form within the application (Access 2007). There is no error number assocatiated with the runtime error message. After clicking OK on the message Access shuts down. All of the VBA modules have error trapping.
The new code involves adding a function that is called from a query. The query is the source for a report that is generated when the Print button is clicked. The query is to complex to include all the necesary tables for the report. The code is attached.
All other features in the new FE are working properly. The user is running Windows 7. I have tried recreating the error on PCs with Vista, 7 and 8 with no luck.
The code is part of a new FE. They downloaded the file using an email link to LogmeIn. The user does a copy/paste to replace the old FE.
Thanks for your help.
Bill
I have a user experiencing a runtime error when the Print button is clicked on one form within the application (Access 2007). There is no error number assocatiated with the runtime error message. After clicking OK on the message Access shuts down. All of the VBA modules have error trapping.
The new code involves adding a function that is called from a query. The query is the source for a report that is generated when the Print button is clicked. The query is to complex to include all the necesary tables for the report. The code is attached.
All other features in the new FE are working properly. The user is running Windows 7. I have tried recreating the error on PCs with Vista, 7 and 8 with no luck.
The code is part of a new FE. They downloaded the file using an email link to LogmeIn. The user does a copy/paste to replace the old FE.
Thanks for your help.
Bill
Code:
Public Function PhysicianNameRetrieval(TblDocID As Variant)
On Error GoTo Err_PhysicianNameRetrieval
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim PhysicianWork As String
PublicVariable9 = TblDocID
Set db = CurrentDb()
Set rst = db.OpenRecordset("QryPhysicianInfoForCMS1500Final", dbOpenDynaset)
If rst.BOF And rst.EOF Then
PhysicianWork = " "
GoTo CloseRecordSet
End If
rst.MoveFirst
PhysicianWork = rst.Fields("[PhysicianNameFull]").Value
PhysicianNameRetrieval = UCase(PhysicianWork)
CloseRecordSet:
rst.Close
Set rst = Nothing
Exit_PhysicianNameRetrieval:
Exit Function
Err_PhysicianNameRetrieval:
Box "Error No: " & Err.Number & "; Description: " & Err.Description
Resume Exit_PhysicianNameRetrieval
End Function