Can someone tell me why my code (below) works when in accdb format but as soon as I convert to accde format I the exact same code doesn't work!
When I run accde, I get the following error:
The expression on Dbl Click you entered as the event property setting produced the following errror:
You entered an expression that requires a form to be the active window.
* The expression may not result in the name of a macro, the name of a user-defined functions, or .
* There may have been an error evaluating the function, event, or macro.
This error occurs when an event has failed to run because Microsoft Office Access cannot evaluate the location of the logic for the event. For example, if the OnOpen property of a form is set to =, this error occurs because Access expects a macro or event name to run when the event is fired.
I could probably alter the code to make it work but that still doesn't answer my question as to why it works with accdb file but not accde??
Shann
Code:
Function AddResults()
Dim LoserScoreSlot, WinSlot, LoseSlot, LoserName As String
LoserScoreSlot = Format(Left(Screen.ActiveForm.ActiveControl.Name, 3), "General Number")
WinSlot = DLookup("[WinSlot]", "Allocations", "[DrawType] = '" & Trim(Left(Screen.ActiveForm.Name, 2))
LoseSlot = DLookup("[LoseSlot]", "Allocations", "[DrawType] = '" & Trim(Left(Screen.ActiveForm.Name, 2))
If Right(Screen.ActiveControl.Name, 1) = "a" Then
LoserName = Left(Screen.ActiveControl.Name, 3) & "b"
Else
LoserName = Left(Screen.ActiveControl.Name, 3) & "a"
End If
If Not LoseSlot = "x" Then Screen.ActiveForm.Controls(LoseSlot) = Screen.ActiveForm.Controls(LoserName)
Screen.ActiveForm.Controls(WinSlot) = Screen.ActiveControl
Screen.ActiveForm.Controls("LOSER SCORE " & LoserScoreSlot) = Forms![Main Menu]![MyResult]
Screen.ActiveForm.Recalc
End Function
When I run accde, I get the following error:
The expression on Dbl Click you entered as the event property setting produced the following errror:
You entered an expression that requires a form to be the active window.
* The expression may not result in the name of a macro, the name of a user-defined functions, or .
* There may have been an error evaluating the function, event, or macro.
This error occurs when an event has failed to run because Microsoft Office Access cannot evaluate the location of the logic for the event. For example, if the OnOpen property of a form is set to =, this error occurs because Access expects a macro or event name to run when the event is fired.
I could probably alter the code to make it work but that still doesn't answer my question as to why it works with accdb file but not accde??
Shann