DoCmd.OpenReport worked once, now error

cjcobra

Registered User.
Local time
Yesterday, 19:59
Joined
Jan 14, 2011
Messages
25
I have the code and it worked once, but it hasn't since.

It pulls from a combobox "Combo1" which pulls from a Table with heading "Name"

It's text, so I have the single quotes in it.

Code:
DoCmd.OpenReport "r_Summary_By_Employee (previous week)", acViewPreview, , "[Name]='" & Me.Combo1 & "'"

The error pops up:
The expression On Click you entered as the event property settings produced the following error: A problem occured while Microsoft Access was communicating with the OLE server or ActiveX Control.

It compiles fine, but maybe a setting got turned off or something?
 
I recreated the form and now it's working. luckily I was still doing some high level design before making it pretty. Still no clue what happened?
 
One thing you should fix - Do NOT use NAME as the name of any object or field in your database. That is one of the very worst ones to use of the Access Reserved Words because almost everything in Access has a NAME property. If I were you, I would change it.
 
You absolutely must heed Bob's advice on this! Here's a link to a list of Reserved Words:

http://www.databasedev.co.uk/ms-access-reserved-words.html

What obviously happened is that your form became corrupted. First thing to do to help prevent this in the future is to go to Options - General and untick everything in the Name AutoCorrect box.

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom