Hi
I'm using this code for a combo box used to open reports but it does not work. THe error message when i select a report from the combo is " The report name 'Screen.ActiveControl' you entered in eitherthe property sheet or macro is misspelled or refers to a report that doesn't exist".
The code is used for the following situation:
- i created a table with the name of the reports (table=Reports, column=Nume_raport)
- then i created in a form the combo list with the code:
Private Sub Combo0_AfterUpdate()
On Error GoTo Combo0_AfterUpdate_Err
If (IsNull(Screen.ActiveControl)) Then
Exit Sub
End If
TempVars.Add "Nume_raport", "Screen.ActiveControl"
If (CurrentProject.IsTrusted) Then
Screen.ActiveControl = Null
End If
DoCmd.OpenReport TempVars!Nume_raport, acViewReport, "", "", acNormal
TempVars.Remove "Nume_raport"
Combo0_AfterUpdate_Exit:
Exit Sub
Combo0_AfterUpdate_Err:
MsgBox Error$
Resume Combo0_AfterUpdate_Exit
End Sub