Results 1 to 2 of 2
  1. #1
    jacek.w.bak is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2011
    Posts
    3

    Compile Error - Ambiguous Name ???

    I filter report on open based on form w/ Customer, and Dates from/to
    On Open procedure :

    Private Sub Report_Open(cancel As Integer)
    ' Set public variable to true to indicate that the report
    ' is in the Open event
    bInReportOpenEvent = True

    ' Open Sales By Category Dialog
    DoCmd.OpenForm "Range", , , , , acDialog



    ' Cancel Report if User Clicked the Cancel Button
    If IsLoaded("Range") = False Then cancel = True

    ' Set public variable to false to indicate that the
    ' Open event is completed
    bInReportOpenEvent = False
    End Sub

    Returns "Compile Error" on Cancel Button
    "Ambiguous Name"

    I have no idea why this happens? Any clues?

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    So, in the report open event, you have code to open a form named "Range" in dialog mode. Something happens in the form "Range", then the form "Range" closes.

    You drop back into the report open code, which then checks if the form "Range" is loaded (by now it is not) and cancels the report open event.

    If you want to cancel the report open, you need to check if the cancel button was selected in the form "Range" *before* the form "Range" closes, pass the result to the report open code, then check to see if the report open should be canceled.

    Returns "Compile Error" on Cancel Button
    "Ambiguous Name"
    Is this error from the Cancel Button code in the form "Range"?
    I've found that this usually this means there are two (or more) 'things' (objects, variables) with the same name.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Compile error. Sub of function not defined
    By plavookins in forum Reports
    Replies: 7
    Last Post: 04-22-2011, 10:15 AM
  2. new compile error!
    By darklite in forum Access
    Replies: 6
    Last Post: 09-02-2010, 05:13 PM
  3. compile error
    By darklite in forum Access
    Replies: 6
    Last Post: 08-31-2010, 04:27 PM
  4. compile error: expected end of statement
    By RedGoneWILD in forum Programming
    Replies: 5
    Last Post: 07-29-2010, 10:12 AM
  5. Ambiguous Outer Join Error
    By scruiks in forum Queries
    Replies: 3
    Last Post: 07-18-2010, 05:06 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums