If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Event procedure coding

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Oct 2010
Posts: 162
Event procedure coding

Does anyone see anything wrong with this code?
Private Sub AWC_EMPLOYEE_Click()
On Error GoTo Err_AWC_EMPLOYEE_Click

Dim stDocName As String

stDocName = "Labels AWC Employees"
DoCmd.OpenReport stDocName, acPreview

Exit_AWC_EMPLOYEE_Click:
Exit Sub

Err_AWC_EMPLOYEE_Click:
MsgBox Err.Description
Resume Exit_AWC_EMPLOYEE_Click

End Sub

This code is used to open address labels based off of a query. It was working fine until yesterday. I think I may have messed something up. Any help is greatly appreciated!
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Oct 2003
Location: London
Posts: 326
DoCmd.OpenReport stDocName, acViewPreview
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Oct 2010
Posts: 162
Ok I'll try it.
Reply With Quote
  #4 (permalink)  
Old
Registered User
 
Join Date: Oct 2010
Posts: 162
I tried changing just that portion of the coding, and still got the same error message. The message I'm receiving is as follows:

"The expression On Click you entered as the event property setting produced the following error: Ambiguous name detected: AWC_Employee_Click."
*The expression may not result in th ename of a macro, th ename of a user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro.

When I clicked help on this error, the message is as follows:
This error occurs when an event has failed to run because the location of the logic for the event cannot be evaluated. For example, if the OnOpen property of a form is set to =[Field], this error occurs because a macro or event name is expected to run when the event occurs.
Reply With Quote
  #5 (permalink)  
Old
Registered User
 
Join Date: Oct 2010
Posts: 162
Apparently this error occurs when there are multiple procedures with the same name in a module.

I don't know what this means.
Reply With Quote
  #6 (permalink)  
Old
Registered User
 
Join Date: Oct 2010
Posts: 162
Never mind! I got it!
Reply With Quote
  #7 (permalink)  
Old
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 12,296
it helps others if you say what you found resolved the problem
__________________
Is taking part in the 'Distinguished Gentlemans' ride. Being neither distinguished nor a gentleman, but I am keen to raise funds for Prostrate Cancer research. At present I'm threatening to ride a Norton 961 wearing a kilt. If you would like to contribute to Prostrate Cancer research then please consider donating via this page:-
http://www.gentlemansride.com/rider/healdem
Reply With Quote
  #8 (permalink)  
Old
Registered User
 
Join Date: Oct 2010
Posts: 162
I thought I did that in my last post, but not enough info...sorry.

open the form in design view

click view code in the tools group on the design tab

click debug

click compile database name

when you receive the error message, click ok

in the code, find the duplicate procedures and delete them.

Hope this is more helpful.
Reply With Quote
  #9 (permalink)  
Old
Registered User
 
Join Date: Oct 2003
Location: London
Posts: 326
All it looks like is that you had two procedures of multiple names.
If you recieve errors like this in future, put the actual error message up. we could have resolved it straight away

Glad it works now.
Reply With Quote
  #10 (permalink)  
Old
Registered User
 
Join Date: Oct 2010
Posts: 162
I did put the actual error code up, see post #4.

Thanks again for your help!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On