If you put the code to modify the form's recordsource in the form's open event, that would guarantee the form was open when the assignment was made.
If you put the code to modify the form's recordsource in the form's open event, that would guarantee the form was open when the assignment was made.
If you don't want user to see data until RecordSource is set, open form hidden then after RecordSource is set, unhide. Otherwise, stay with the QueryDefs code.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.