Hello - I've been using the snip of code below in my application menus forever. "strExec" is the name of an Access object; when the user selects a menu option, it runs through the Select Case, doing the appropriate thing. If it's a user-defined function, it gets executed with the Eval() function in the Case Else.
Never had any problems up to now, but now I'm getting "The expression you entered contains invalid syntax." on this new UDF I just added. The only difference I can see is that this function contains arg's passed with "Optional ByVal"
This new function call works fine when exec'd from the Immediate Window.
It also works fine from my menu if I do not pass values for the "Optional ByVal" arg's:
FormOpenStd("frmTest", "frmMainMenu") <--- works
FormOpenStd("frmTest", "frmMainMenu", , , , nvvarWndMode:=acWindowNorm
Procs <--- gets error
This is Access 2003
Select Case Left$(strExec, 3)
Me.Visible = 0
DoCmd.OpenReport strExec, acViewPreview